Skip to content

Commit 368f3cb

Browse files
bk2204gitster
authored andcommitted
t6500: specify test values for SHA-256
In this test, we want to produce several blobs whose first two hex characters are "17", since we look at this object directory as a proxy for how many loose objects there are before we need to GC. Use test_oid_cache to specify strings that will hash to the right values when turned into blobs. Signed-off-by: brian m. carlson <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent abe3db1 commit 368f3cb

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

t/t6500-gc.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,24 @@ test_expect_success 'setup' '
1010
# do not let the amount of physical memory affects gc
1111
# behavior, make sure we always pack everything to one pack by
1212
# default
13-
git config gc.bigPackThreshold 2g
13+
git config gc.bigPackThreshold 2g &&
14+
15+
# These are simply values which, when hashed as a blob with a newline,
16+
# produce a hash where the first byte is 0x17 in their respective
17+
# algorithms.
18+
test_oid_cache <<-EOF
19+
obj1 sha1:263
20+
obj1 sha256:34
21+
22+
obj2 sha1:410
23+
obj2 sha256:174
24+
25+
obj3 sha1:523
26+
obj3 sha256:313
27+
28+
obj4 sha1:790
29+
obj4 sha256:481
30+
EOF
1431
'
1532

1633
test_expect_success 'gc empty repository' '
@@ -85,13 +102,13 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
85102
# We need to create two object whose sha1s start with 17
86103
# since this is what git gc counts. As it happens, these
87104
# two blobs will do so.
88-
test_commit 263 &&
89-
test_commit 410 &&
105+
test_commit "$(test_oid obj1)" &&
106+
test_commit "$(test_oid obj2)" &&
90107
# Our first gc will create a pack; our second will create a second pack
91108
git gc --auto &&
92109
ls .git/objects/pack | sort >existing_packs &&
93-
test_commit 523 &&
94-
test_commit 790 &&
110+
test_commit "$(test_oid obj3)" &&
111+
test_commit "$(test_oid obj4)" &&
95112
96113
git gc --auto 2>err &&
97114
test_i18ngrep ! "^warning:" err &&

0 commit comments

Comments
 (0)