Skip to content

Commit 0d1806e

Browse files
chooglengitster
authored andcommitted
read-tree + fetch tests: test failing "--super-prefix" interaction
Ever since "git fetch --refetch" was introduced in 0f5e885 (Merge branch 'rc/fetch-refetch', 2022-04-04) the test being added here would fail. This is because "restore" will "read-tree .. --reset <hash>", which will in turn invoke "fetch". The "fetch" will then die with: fatal: fetch doesn't support --super-prefix This edge case and other "--super-prefix" bugs will be fixed in subsequent commits, but let's first add a "test_expect_failure" test for it. It passes until the very last command in the test. Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 49eb1d3 commit 0d1806e

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

t/t5616-partial-clone.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,49 @@ test_expect_success 'repack does not loosen promisor objects' '
644644
grep "loosen_unused_packed_objects/loosened:0" trace
645645
'
646646

647+
test_expect_failure 'lazy-fetch in submodule succeeds' '
648+
# setup
649+
test_config_global protocol.file.allow always &&
650+
651+
test_when_finished "rm -rf src-sub" &&
652+
git init src-sub &&
653+
git -C src-sub config uploadpack.allowfilter 1 &&
654+
git -C src-sub config uploadpack.allowanysha1inwant 1 &&
655+
656+
# This blob must be missing in the subsequent commit.
657+
echo foo >src-sub/file &&
658+
git -C src-sub add file &&
659+
git -C src-sub commit -m "submodule one" &&
660+
SUB_ONE=$(git -C src-sub rev-parse HEAD) &&
661+
662+
echo bar >src-sub/file &&
663+
git -C src-sub add file &&
664+
git -C src-sub commit -m "submodule two" &&
665+
SUB_TWO=$(git -C src-sub rev-parse HEAD) &&
666+
667+
test_when_finished "rm -rf src-super" &&
668+
git init src-super &&
669+
git -C src-super config uploadpack.allowfilter 1 &&
670+
git -C src-super config uploadpack.allowanysha1inwant 1 &&
671+
git -C src-super submodule add ../src-sub src-sub &&
672+
673+
git -C src-super/src-sub checkout $SUB_ONE &&
674+
git -C src-super add src-sub &&
675+
git -C src-super commit -m "superproject one" &&
676+
677+
git -C src-super/src-sub checkout $SUB_TWO &&
678+
git -C src-super add src-sub &&
679+
git -C src-super commit -m "superproject two" &&
680+
681+
# the fetch
682+
test_when_finished "rm -rf client" &&
683+
git clone --filter=blob:none --also-filter-submodules \
684+
--recurse-submodules "file://$(pwd)/src-super" client &&
685+
686+
# Trigger lazy-fetch from the superproject
687+
git -C client restore --recurse-submodules --source=HEAD^ :/
688+
'
689+
647690
. "$TEST_DIRECTORY"/lib-httpd.sh
648691
start_httpd
649692

0 commit comments

Comments
 (0)