summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2011-06-06 19:58:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-06-06 20:46:36 (GMT)
commit4d689320049e1ff3bd31e0468d6f17eeb0b7029c (patch)
treeb3f96609e1df7afbb3640a8384721f39aa4098eb /t
parent8537f0ef936781d3984491603cd1c8ff15d7a8a5 (diff)
downloadgit-4d689320049e1ff3bd31e0468d6f17eeb0b7029c.zip
git-4d689320049e1ff3bd31e0468d6f17eeb0b7029c.tar.gz
git-4d689320049e1ff3bd31e0468d6f17eeb0b7029c.tar.bz2
submodule add: allow relative repository path even when no url is set
Adding a submodule with a relative repository path did only succeed when the superproject's default remote was set. But when that is unset, the superproject is its own authoritative upstream, so lets use its working directory as upstream instead. This allows users to set up a new superpoject where the submodules urls are configured relative to the superproject's upstream while its default remote can be configured later. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7400-submodule-basic.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index cae5fd0..9099e80 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -446,10 +446,13 @@ test_expect_success 'add should fail when path is used by an existing directory'
)
'
-test_expect_success 'add should fail when path is relative but no url is set in the superproject' '
+test_expect_success 'use superproject as upstream when path is relative and no url is set there' '
(
cd addtest &&
- test_must_fail git submodule add ../repo relative
+ git submodule add ../repo relative &&
+ test "$(git config -f .gitmodules submodule.relative.url)" = ../repo &&
+ git submodule sync relative &&
+ test "$(git config submodule.relative.url)" = "$submodurl/repo"
)
'