Skip to content

Commit fe6f2b0

Browse files
peffgitster
authored andcommitted
t5304: add a test for pruning with bitmaps
Commit fde67d6 (prune: use bitmaps for reachability traversal, 2019-02-13) uses bitmaps for pruning when they're available, but only covers this functionality in the t/perf tests. This makes a kind of sense, since the point is that the behaviour is indistinguishable before and after the patch, just faster. But since the bitmap code path is not exercised at all in the regular test suite, it leaves us open to a regression where the behavior does in fact change. The most thorough way to test that would be running the whole suite with bitmaps enabled. But we don't yet have a way to do that, and anyway it's expensive to do so. Let's at least add a basic test that exercises this path and make sure we prune an object we should (and not one that we shouldn't). That would hopefully catch the most obvious breakages early. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cc80c95 commit fe6f2b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

t/t5304-prune.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,12 @@ test_expect_success 'prune: handle expire option correctly' '
341341
git prune --no-expire
342342
'
343343

344+
test_expect_success 'trivial prune with bitmaps enabled' '
345+
git repack -adb &&
346+
blob=$(echo bitmap-unreachable-blob | git hash-object -w --stdin) &&
347+
git prune --expire=now &&
348+
git cat-file -e HEAD &&
349+
test_must_fail git cat-file -e $blob
350+
'
351+
344352
test_done

0 commit comments

Comments
 (0)