t: prepare for GIT_TEST_WRITE_REV_INDEX

In the next patch, we'll add support for unconditionally enabling the 'pack.writeReverseIndex' setting with a new GIT_TEST_WRITE_REV_INDEX environment variable. This causes a little bit of fallout with tests that, for example, compare the list of files in the pack directory being unprepared to see .rev files in its output. Those locations can be cleaned up to look for specific file extensions, rather than take everything in the pack directory (for instance) and then grep out unwanted items. Once the pack.writeReverseIndex option has been thoroughly tested, we will default it to 'true', removing GIT_TEST_WRITE_REV_INDEX, and making it possible to revert this patch. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Jan 25, 2021 at 18:37 UTC 35a8a3547a841b031b14cd759cf53996bca89baf
6 files changed +23 -11
t/t5319-multi-pack-index.sh
+3 -2
@@ -710,8 +710,9 @@ test_expect_success 'expire respects .keep files' '
710 PACKA=$(ls .git/objects/pack/a-pack*\.pack | sed s/\.pack\$//) &&
711 touch $PACKA.keep &&
712 git multi-pack-index expire &&
713 - ls -S .git/objects/pack/a-pack* | grep $PACKA >a-pack-files &&
714 - test_line_count = 3 a-pack-files &&
713 + test_path_is_file $PACKA.idx &&
714 + test_path_is_file $PACKA.keep &&
715 + test_path_is_file $PACKA.pack &&
716 test-tool read-midx .git/objects | grep idx >midx-list &&
717 test_line_count = 2 midx-list
718 )
t/t5325-reverse-index.sh
+4
@@ -3,6 +3,10 @@
3 test_description='on-disk reverse index'
4 . ./test-lib.sh
5
6 +# The below tests want control over the 'pack.writeReverseIndex' setting
7 +# themselves to assert various combinations of it with other options.
8 +sane_unset GIT_TEST_WRITE_REV_INDEX
9 +
10 packdir=.git/objects/pack
11
12 test_expect_success 'setup' '
t/t5604-clone-reference.sh
+1 -1
@@ -329,7 +329,7 @@ test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at obje
329 for raw in $(ls T*.raw)
330 do
331 sed -e "s!/../!/Y/!; s![0-9a-f]\{38,\}!Z!" -e "/commit-graph/d" \
332 - -e "/multi-pack-index/d" <$raw >$raw.de-sha-1 &&
332 + -e "/multi-pack-index/d" -e "/rev/d" <$raw >$raw.de-sha-1 &&
333 sort $raw.de-sha-1 >$raw.de-sha || return 1
334 done &&
335
t/t5702-protocol-v2.sh
+8 -4
@@ -851,8 +851,10 @@ test_expect_success 'part of packfile response provided as URI' '
851 test -f h2found &&
852
853 # Ensure that there are exactly 6 files (3 .pack and 3 .idx).
854 - ls http_child/.git/objects/pack/* >filelist &&
855 - test_line_count = 6 filelist
854 + ls http_child/.git/objects/pack/*.pack >packlist &&
855 + ls http_child/.git/objects/pack/*.idx >idxlist &&
856 + test_line_count = 3 idxlist &&
857 + test_line_count = 3 packlist
858 '
859
860 test_expect_success 'fetching with valid packfile URI but invalid hash fails' '
@@ -905,8 +907,10 @@ test_expect_success 'packfile-uri with transfer.fsckobjects' '
907 clone "$HTTPD_URL/smart/http_parent" http_child &&
908
909 # Ensure that there are exactly 4 files (2 .pack and 2 .idx).
908 - ls http_child/.git/objects/pack/* >filelist &&
909 - test_line_count = 4 filelist
910 + ls http_child/.git/objects/pack/*.pack >packlist &&
911 + ls http_child/.git/objects/pack/*.idx >idxlist &&
912 + test_line_count = 2 idxlist &&
913 + test_line_count = 2 packlist
914 '
915
916 test_expect_success 'packfile-uri with transfer.fsckobjects fails on bad object' '
t/t6500-gc.sh
+3 -3
@@ -106,17 +106,17 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
106 test_commit "$(test_oid obj2)" &&
107 # Our first gc will create a pack; our second will create a second pack
108 git gc --auto &&
109 - ls .git/objects/pack | sort >existing_packs &&
109 + ls .git/objects/pack/pack-*.pack | sort >existing_packs &&
110 test_commit "$(test_oid obj3)" &&
111 test_commit "$(test_oid obj4)" &&
112
113 git gc --auto 2>err &&
114 test_i18ngrep ! "^warning:" err &&
115 - ls .git/objects/pack/ | sort >post_packs &&
115 + ls .git/objects/pack/pack-*.pack | sort >post_packs &&
116 comm -1 -3 existing_packs post_packs >new &&
117 comm -2 -3 existing_packs post_packs >del &&
118 test_line_count = 0 del && # No packs are deleted
119 - test_line_count = 2 new # There is one new pack and its .idx
119 + test_line_count = 1 new # There is one new pack
120 '
121
122 test_expect_success 'gc --no-quiet' '
t/t9300-fast-import.sh
+4 -1
@@ -1632,7 +1632,10 @@ test_expect_success 'O: blank lines not necessary after other commands' '
1632 INPUT_END
1633
1634 git fast-import <input &&
1635 - test 8 = $(find .git/objects/pack -type f | grep -v multi-pack-index | wc -l) &&
1635 + ls -la .git/objects/pack/pack-*.pack >packlist &&
1636 + ls -la .git/objects/pack/pack-*.pack >idxlist &&
1637 + test_line_count = 4 idxlist &&
1638 + test_line_count = 4 packlist &&
1639 test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
1640 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1641 test_cmp expect actual