summaryrefslogtreecommitdiff
path: root/t/t5526-fetch-submodules.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2011-03-06 22:12:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-03-09 21:10:35 (GMT)
commitc16c3e40b5908ecf28be12b1caf266c7ab8de3c6 (patch)
tree9ce602aebbccf20d66dd73d10b613d85bead1988 /t/t5526-fetch-submodules.sh
parentbf42b384058ee2b34f587426d0788353ffa9012a (diff)
downloadgit-c16c3e40b5908ecf28be12b1caf266c7ab8de3c6.zip
git-c16c3e40b5908ecf28be12b1caf266c7ab8de3c6.tar.gz
git-c16c3e40b5908ecf28be12b1caf266c7ab8de3c6.tar.bz2
fetch/pull: Don't recurse into a submodule when commits are already present
When looking for submodules where new commits have been recorded in the superproject ignore those cases where the submodules commits are already present locally. This can happen e.g. when the submodule has been rewound to an earlier state. Then there is no need to fetch the submodule again as the commit recorded in the newly fetched superproject commit has already been fetched earlier into the submodule. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5526-fetch-submodules.sh')
-rwxr-xr-xt/t5526-fetch-submodules.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 09701aa..3decfae 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -428,4 +428,23 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
test_cmp expect.err.2 actual.err
'
+test_expect_success "don't fetch submodule when newly recorded commits are already present" '
+ (
+ cd submodule &&
+ git checkout -q HEAD^^
+ ) &&
+ head1=$(git rev-parse --short HEAD) &&
+ git add submodule &&
+ git commit -m "submodule rewound" &&
+ head2=$(git rev-parse --short HEAD) &&
+ echo "From $pwd/." > expect.err &&
+ echo " $head1..$head2 master -> origin/master" >> expect.err &&
+ (
+ cd downstream &&
+ git fetch >../actual.out 2>../actual.err
+ ) &&
+ ! test -s actual.out &&
+ test_cmp expect.err actual.err
+'
+
test_done