t6500: extract objects with "17" prefix
The ".git/obects/17/" shard is somewhat special because it is used by git-gc(1) to estimate how many objects there are by extrapolating the number of objects in that shard, only. In t6500 we thus have a hard coded set of data that, when written to the object database, result in blobs starting with that prefix. We are about to need such "17"-prefixed objects in another test suite. Extract them into "t/oid-info/hash-info" so that they can be reused by other tests. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Mar 25, 2024 at 11:03 UTC
77257e3c7e342acc0022c8c206db6c248cbfeb85
2 files changed
+19
-23
t/oid-info/hash-info
+12
@@ -15,3 +15,15 @@ empty_blob sha256:473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a3037218
15
16
empty_tree sha1:4b825dc642cb6eb9a060e54bf8d69288fbee4904
17
empty_tree sha256:6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321
18
+
19
+blob17_1 sha1:263
20
+blob17_1 sha256:34
21
+
22
+blob17_2 sha1:410
23
+blob17_2 sha256:174
24
+
25
+blob17_3 sha1:523
26
+blob17_3 sha256:313
27
+
28
+blob17_4 sha1:790
29
+blob17_4 sha256:481
t/t6500-gc.sh
+7
-23
@@ -11,23 +11,7 @@ test_expect_success 'setup' '
11
# behavior, make sure we always pack everything to one pack by
12
# default
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
14
+ test_oid_init
15
'
16
17
test_expect_success 'gc empty repository' '
@@ -114,8 +98,8 @@ test_expect_success 'pre-auto-gc hook can stop auto gc' '
98
# We need to create two object whose sha1s start with 17
99
# since this is what git gc counts. As it happens, these
100
# two blobs will do so.
117
- test_commit "$(test_oid obj1)" &&
118
- test_commit "$(test_oid obj2)" &&
101
+ test_commit "$(test_oid blob17_1)" &&
102
+ test_commit "$(test_oid blob17_2)" &&
103
104
git gc --auto >../out.actual 2>../err.actual
105
) &&
@@ -146,13 +130,13 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
130
# We need to create two object whose sha1s start with 17
131
# since this is what git gc counts. As it happens, these
132
# two blobs will do so.
149
- test_commit "$(test_oid obj1)" &&
150
- test_commit "$(test_oid obj2)" &&
133
+ test_commit "$(test_oid blob17_1)" &&
134
+ test_commit "$(test_oid blob17_2)" &&
135
# Our first gc will create a pack; our second will create a second pack
136
git gc --auto &&
137
ls .git/objects/pack/pack-*.pack | sort >existing_packs &&
154
- test_commit "$(test_oid obj3)" &&
155
- test_commit "$(test_oid obj4)" &&
138
+ test_commit "$(test_oid blob17_3)" &&
139
+ test_commit "$(test_oid blob17_4)" &&
140
141
git gc --auto 2>err &&
142
test_grep ! "^warning:" err &&