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>
This commit is contained in:
committed by
Junio C Hamano
parent
bf42b38405
commit
c16c3e40b5
@ -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
|
||||
|
||||
Reference in New Issue
Block a user