summaryrefslogtreecommitdiff
path: root/t/t5526-fetch-submodules.sh
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2017-10-16 13:58:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-17 01:27:18 (GMT)
commitc68f8375760dc6b77f9c68772230a9c6cfd52aa7 (patch)
tree716f4062df270db00a781b58877f733b8b013665 /t/t5526-fetch-submodules.sh
parent01ce12252c959ed0f4b4b021adffa7a84a2d64a6 (diff)
downloadgit-c68f8375760dc6b77f9c68772230a9c6cfd52aa7.zip
git-c68f8375760dc6b77f9c68772230a9c6cfd52aa7.tar.gz
git-c68f8375760dc6b77f9c68772230a9c6cfd52aa7.tar.bz2
implement fetching of moved submodules
We store the changed submodules paths to calculate which submodule needs fetching. This does not work for moved submodules since their paths do not stay the same in case of a moved submodules. In case of new submodules we do not have a path in the current checkout, since they just appeared in this fetch. It is more general to collect the submodule names for changes instead of their paths to include the above cases. If we do not have a configuration for a gitlink we rely on constructing a default name from the path if a git repository can be found at its path. We skip non-configured gitlinks whose default name collides with a configured one. With the change described above we implement 'on-demand' fetching of changes in moved submodules. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5526-fetch-submodules.sh')
-rwxr-xr-xt/t5526-fetch-submodules.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 43a22f6..a552ad4 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -570,4 +570,39 @@ test_expect_success 'fetching submodule into a broken repository' '
test_must_fail git -C dst fetch --recurse-submodules
'
+test_expect_success "fetch new commits when submodule got renamed" '
+ git clone . downstream_rename &&
+ (
+ cd downstream_rename &&
+ git submodule update --init &&
+# NEEDSWORK: we omitted --recursive for the submodule update here since
+# that does not work. See test 7001 for mv "moving nested submodules"
+# for details. Once that is fixed we should add the --recursive option
+# here.
+ git checkout -b rename &&
+ git mv submodule submodule_renamed &&
+ (
+ cd submodule_renamed &&
+ git checkout -b rename_sub &&
+ echo a >a &&
+ git add a &&
+ git commit -ma &&
+ git push origin rename_sub &&
+ git rev-parse HEAD >../../expect
+ ) &&
+ git add submodule_renamed &&
+ git commit -m "update renamed submodule" &&
+ git push origin rename
+ ) &&
+ (
+ cd downstream &&
+ git fetch --recurse-submodules=on-demand &&
+ (
+ cd submodule &&
+ git rev-parse origin/rename_sub >../../actual
+ )
+ ) &&
+ test_cmp expect actual
+'
+
test_done