From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 5/5] Teach 'git submodule' to rewrite submodule URLs according to super-repo's rules
Date: Mon, 04 Aug 2008 01:02:58 +0200 [thread overview]
Message-ID: <200808040102.58275.johan@herland.net> (raw)
In-Reply-To: <200808040057.00221.johan@herland.net>
When a 'url.*.insteadOf' rule in the superrepo matches a submodule URL, we
should rewrite the submodule URL accordingly, so that we don't request the
submodule from location that is inaccessible (or unwanted by the user for
some other reason).
Signed-off-by: Johan Herland <johan@herland.net>
---
git-submodule.sh | 6 ++++++
t/t7400-submodule-basic.sh | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index b40f876..ea2aa3b 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -96,6 +96,12 @@ module_clone()
test -e "$path" &&
die "A file already exist at path '$path'"
+ # The user may have added url.*.insteadOf rules intending to rewrite
+ # submodule URLs. We must explicitly do this rewrite before calling
+ # 'git clone', since 'git clone' will not consult the super-repo
+ # config and thus never see any url.*.insteadOf rules placed therein.
+ url=$(git config --rewrite-url "$url")
+
git-clone -n "$url" "$path" ||
die "Clone of '$url' into submodule path '$path' failed"
}
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index bafc46c..9c56de2 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -209,7 +209,7 @@ test_expect_success 'update --init' '
'
-test_expect_failure 'update --init with url.*.insteadOf' '
+test_expect_success 'update --init with url.*.insteadOf' '
rm -rf init &&
git config -f .gitmodules submodule.example.url "http://example.com/init2" &&
--
1.6.0.rc1.34.g0fe8c
next prev parent reply other threads:[~2008-08-03 23:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-03 22:57 [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs Johan Herland
2008-08-03 23:00 ` [PATCH 1/5] Add testcase for 'git submodule' with url.*.insteadOf set in the super-repo Johan Herland
2008-08-03 23:04 ` [PATCH 1/5 v2] " Johan Herland
2008-08-03 23:01 ` [PATCH 2/5] Teach 'git config' to rewrite URLs according to current url.*.insteadOf rules Johan Herland
2008-08-03 23:02 ` [PATCH 3/5] Add selftest for new option '--rewrite-url' to 'git config' Johan Herland
2008-08-03 23:02 ` [PATCH 4/5] Add documentation on the new --rewrite-url option " Johan Herland
2008-08-03 23:02 ` Johan Herland [this message]
2008-08-03 23:27 ` [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs Johannes Schindelin
2008-08-03 23:47 ` Johan Herland
2008-08-04 2:06 ` Junio C Hamano
2008-08-04 7:52 ` Johan Herland
2008-08-03 23:57 ` Junio C Hamano
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=200808040102.58275.johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.