read-tree + fetch tests: test failing "--super-prefix" interaction
Ever since "git fetch --refetch" was introduced in 0f5e8851737 (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 <chooglen@google.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Glen Choo committed
Dec 20, 2022 at 13:39 UTC
0d1806e53de6ac26021d8aab918d76381287f339
1 file changed
+43
t/t5616-partial-clone.sh
+43
@@ -644,6 +644,49 @@ test_expect_success 'repack does not loosen promisor objects' '
644
grep "loosen_unused_packed_objects/loosened:0" trace
645
'
646
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
+
690
. "$TEST_DIRECTORY"/lib-httpd.sh
691
start_httpd
692