From: Jacob Helwig <jacob.helwig@gmail.com>
To: git@vger.kernel.org
To: git@vger.kernel.org
Cc: Jacob Helwig <jacob.helwig@gmail.com>,
Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH] submodule: Improve handling of relative submodule URLs.
Date: Thu, 25 Feb 2010 11:28:29 -0800 [thread overview]
Message-ID: <1267126109-14638-1-git-send-email-jacob.helwig@gmail.com> (raw)
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
next reply other threads:[~2010-02-25 19:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 19:28 Jacob Helwig [this message]
2010-02-26 2:03 ` [PATCH] submodule: Improve handling of relative submodule URLs Mark Levedahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267126109-14638-1-git-send-email-jacob.helwig@gmail.com \
--to=jacob.helwig@gmail.com \
--cc=git@vger.kernel.org \
--cc=mlevedahl@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).