Skip to content

Commit 35a8a35

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1615c56 commit 35a8a35

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

t/t5319-multi-pack-index.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,9 @@ test_expect_success 'expire respects .keep files' '
710710
PACKA=$(ls .git/objects/pack/a-pack*\.pack | sed s/\.pack\$//) &&
711711
touch $PACKA.keep &&
712712
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 &&
715716
test-tool read-midx .git/objects | grep idx >midx-list &&
716717
test_line_count = 2 midx-list
717718
)

t/t5325-reverse-index.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
test_description='on-disk reverse index'
44
. ./test-lib.sh
55

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+
610
packdir=.git/objects/pack
711

812
test_expect_success 'setup' '

t/t5604-clone-reference.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at obje
329329
for raw in $(ls T*.raw)
330330
do
331331
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 &&
333333
sort $raw.de-sha-1 >$raw.de-sha || return 1
334334
done &&
335335

t/t5702-protocol-v2.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,10 @@ test_expect_success 'part of packfile response provided as URI' '
851851
test -f h2found &&
852852
853853
# 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
856858
'
857859

858860
test_expect_success 'fetching with valid packfile URI but invalid hash fails' '
@@ -905,8 +907,10 @@ test_expect_success 'packfile-uri with transfer.fsckobjects' '
905907
clone "$HTTPD_URL/smart/http_parent" http_child &&
906908
907909
# 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
910914
'
911915

912916
test_expect_success 'packfile-uri with transfer.fsckobjects fails on bad object' '

t/t6500-gc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
106106
test_commit "$(test_oid obj2)" &&
107107
# Our first gc will create a pack; our second will create a second pack
108108
git gc --auto &&
109-
ls .git/objects/pack | sort >existing_packs &&
109+
ls .git/objects/pack/pack-*.pack | sort >existing_packs &&
110110
test_commit "$(test_oid obj3)" &&
111111
test_commit "$(test_oid obj4)" &&
112112
113113
git gc --auto 2>err &&
114114
test_i18ngrep ! "^warning:" err &&
115-
ls .git/objects/pack/ | sort >post_packs &&
115+
ls .git/objects/pack/pack-*.pack | sort >post_packs &&
116116
comm -1 -3 existing_packs post_packs >new &&
117117
comm -2 -3 existing_packs post_packs >del &&
118118
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
120120
'
121121

122122
test_expect_success 'gc --no-quiet' '

t/t9300-fast-import.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,10 @@ test_expect_success 'O: blank lines not necessary after other commands' '
16321632
INPUT_END
16331633
16341634
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 &&
16361639
test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
16371640
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
16381641
test_cmp expect actual

0 commit comments

Comments
 (0)