* [PATCH] submodule: Improve handling of relative submodule URLs.
@ 2010-02-25 19:28 Jacob Helwig
2010-02-26 2:03 ` Mark Levedahl
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Helwig @ 2010-02-25 19:28 UTC (permalink / raw)
To: git, git; +Cc: Jacob Helwig, Mark Levedahl
Relative URLs only worked with <proto>://<host>/<location> style URLs, and
would break when cloning a repository using <user>@<host>:<location> (scp)
style "URL"s.
When a submodule's URL was set to "../submodule.git", and the repository
using it was cloned from "git@example.com:repo.git", git would try to
clone the submodule from "git@example.com:repo.git/submodule.git", which
would not likely work.
This updates resolve_relative_url to handle the scp style URLs.
Signed-off-by: Jacob Helwig <jacob.helwig@gmail.com>
---
git-submodule.sh | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 664f217..97787a3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -37,18 +37,19 @@ resolve_relative_url ()
while test -n "$url"
do
case "$url" in
- ../*)
+ ..[/:]*)
url="${url#../}"
- remoteurl="${remoteurl%/*}"
+ remoteurl="$(echo "$remoteurl" | sed -e 's|\(.*[/:]\).*|\1|')"
;;
- ./*)
+ .[/:]*)
url="${url#./}"
+ remoteurl="$remoteurl/"
;;
*)
break;;
esac
done
- echo "$remoteurl/${url%/}"
+ echo "$remoteurl${url#[/:]}"
}
#
--
1.7.0.91.g310a
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] submodule: Improve handling of relative submodule URLs.
2010-02-25 19:28 [PATCH] submodule: Improve handling of relative submodule URLs Jacob Helwig
@ 2010-02-26 2:03 ` Mark Levedahl
0 siblings, 0 replies; 2+ messages in thread
From: Mark Levedahl @ 2010-02-26 2:03 UTC (permalink / raw)
To: Jacob Helwig; +Cc: git
On 02/25/2010 02:28 PM, Jacob Helwig wrote:
> Relative URLs only worked with<proto>://<host>/<location> style URLs, and
> would break when cloning a repository using<user>@<host>:<location> (scp)
> style "URL"s.
>
> When a submodule's URL was set to "../submodule.git", and the repository
> using it was cloned from "git@example.com:repo.git", git would try to
> clone the submodule from "git@example.com:repo.git/submodule.git", which
> would not likely work.
>
My solution for this has been to always give the full path, possibly using ~
e.g., git@example.com:~/repo.git
and as that works fine, I'm indifferent to this proposed change.
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-26 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 19:28 [PATCH] submodule: Improve handling of relative submodule URLs Jacob Helwig
2010-02-26 2:03 ` Mark Levedahl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).