Skip to content

Commit b934207

Browse files
ttaylorrgitster
authored andcommitted
t/t5304-prune.sh: prepare for gc --cruft by default
Many of the tests in t5304 run `git gc`, and rely on its behavior that unreachable-but-recent objects are written out loose. This is sensible, since t5304 deals specifically with this kind of pruning. If left unattended, however, this test would break when the default behavior of a bare "git gc" is adjusted to generate a cruft pack by default. Ensure that these tests continue to work as-is (and continue to provide coverage of loose object pruning) by passing `--no-cruft` explicitly. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05b9013 commit b934207

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

t/t5304-prune.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ test_expect_success 'prune --expire' '
6262
test_expect_success 'gc: implicit prune --expire' '
6363
add_blob &&
6464
test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
65-
git gc &&
65+
git gc --no-cruft &&
6666
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
6767
test_path_is_file $BLOB_FILE &&
6868
test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
69-
git gc &&
69+
git gc --no-cruft &&
7070
verbose test $before = $(git count-objects | sed "s/ .*//") &&
7171
test_path_is_missing $BLOB_FILE
7272
'
@@ -86,7 +86,7 @@ test_expect_success 'gc: refuse to start with invalid gc.pruneExpire' '
8686

8787
test_expect_success 'gc: start with ok gc.pruneExpire' '
8888
git config gc.pruneExpire 2.days.ago &&
89-
git gc
89+
git gc --no-cruft
9090
'
9191

9292
test_expect_success 'prune: prune nonsense parameters' '
@@ -137,44 +137,44 @@ test_expect_success 'gc --no-prune' '
137137
add_blob &&
138138
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
139139
git config gc.pruneExpire 2.days.ago &&
140-
git gc --no-prune &&
140+
git gc --no-prune --no-cruft &&
141141
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
142142
test_path_is_file $BLOB_FILE
143143
'
144144

145145
test_expect_success 'gc respects gc.pruneExpire' '
146146
git config gc.pruneExpire 5002.days.ago &&
147-
git gc &&
147+
git gc --no-cruft &&
148148
test_path_is_file $BLOB_FILE &&
149149
git config gc.pruneExpire 5000.days.ago &&
150-
git gc &&
150+
git gc --no-cruft &&
151151
test_path_is_missing $BLOB_FILE
152152
'
153153

154154
test_expect_success 'gc --prune=<date>' '
155155
add_blob &&
156156
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
157-
git gc --prune=5002.days.ago &&
157+
git gc --prune=5002.days.ago --no-cruft &&
158158
test_path_is_file $BLOB_FILE &&
159-
git gc --prune=5000.days.ago &&
159+
git gc --prune=5000.days.ago --no-cruft &&
160160
test_path_is_missing $BLOB_FILE
161161
'
162162

163163
test_expect_success 'gc --prune=never' '
164164
add_blob &&
165-
git gc --prune=never &&
165+
git gc --prune=never --no-cruft &&
166166
test_path_is_file $BLOB_FILE &&
167-
git gc --prune=now &&
167+
git gc --prune=now --no-cruft &&
168168
test_path_is_missing $BLOB_FILE
169169
'
170170

171171
test_expect_success 'gc respects gc.pruneExpire=never' '
172172
git config gc.pruneExpire never &&
173173
add_blob &&
174-
git gc &&
174+
git gc --no-cruft &&
175175
test_path_is_file $BLOB_FILE &&
176176
git config gc.pruneExpire now &&
177-
git gc &&
177+
git gc --no-cruft &&
178178
test_path_is_missing $BLOB_FILE
179179
'
180180

@@ -194,7 +194,7 @@ test_expect_success 'gc: prune old objects after local clone' '
194194
cd aclone &&
195195
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
196196
test_path_is_file $BLOB_FILE &&
197-
git gc --prune &&
197+
git gc --prune --no-cruft &&
198198
verbose test 0 = $(git count-objects | sed "s/ .*//") &&
199199
test_path_is_missing $BLOB_FILE
200200
)
@@ -237,7 +237,7 @@ test_expect_success 'clean pack garbage with gc' '
237237
>.git/objects/pack/fake2.keep &&
238238
>.git/objects/pack/fake2.idx &&
239239
>.git/objects/pack/fake3.keep &&
240-
git gc &&
240+
git gc --no-cruft &&
241241
git count-objects -v 2>stderr &&
242242
grep "^warning:" stderr | sort >actual &&
243243
cat >expected <<\EOF &&

0 commit comments

Comments
 (0)