summaryrefslogtreecommitdiff
path: root/t/t6500-gc.sh
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2023-10-02 16:55:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-10-02 21:54:30 (GMT)
commit1cd43a9ed96831b983fada37a71daacb6be373dc (patch)
tree8dc11eee02d8ca8bd1de7f9994918448a5c11ec8 /t/t6500-gc.sh
parent48a9b67b4301083d0820e90afef208ed1436298f (diff)
downloadgit-1cd43a9ed96831b983fada37a71daacb6be373dc.zip
git-1cd43a9ed96831b983fada37a71daacb6be373dc.tar.gz
git-1cd43a9ed96831b983fada37a71daacb6be373dc.tar.bz2
gc: add `gc.repackFilter` config option
A previous commit has implemented `git repack --filter=<filter-spec>` to allow users to filter out some objects from the main pack and move them into a new different pack. Users might want to perform such a cleanup regularly at the same time as they perform other repacks and cleanups, so as part of `git gc`. Let's allow them to configure a <filter-spec> for that purpose using a new gc.repackFilter config option. Now when `git gc` will perform a repack with a <filter-spec> configured through this option and not empty, the repack process will be passed a corresponding `--filter=<filter-spec>` argument. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-xt/t6500-gc.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 69509d0..232e403 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -202,6 +202,19 @@ test_expect_success 'one of gc.reflogExpire{Unreachable,}=never does not skip "e
grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
'
+test_expect_success 'gc.repackFilter launches repack with a filter' '
+ test_when_finished "rm -rf bare.git" &&
+ git clone --no-local --bare . bare.git &&
+
+ git -C bare.git -c gc.cruftPacks=false gc &&
+ test_stdout_line_count = 1 ls bare.git/objects/pack/*.pack &&
+
+ GIT_TRACE=$(pwd)/trace.out git -C bare.git -c gc.repackFilter=blob:none \
+ -c repack.writeBitmaps=false -c gc.cruftPacks=false gc &&
+ test_stdout_line_count = 2 ls bare.git/objects/pack/*.pack &&
+ grep -E "^trace: (built-in|exec|run_command): git repack .* --filter=blob:none ?.*" trace.out
+'
+
prepare_cruft_history () {
test_commit base &&