From: Emily Shaffer Date: Wed, 26 Oct 2022 21:32:43 +0000 (-0400) Subject: gc: add tests for --cruft and friends X-Git-Tag: v2.39.0-rc0~45^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12253ab6d0;p=thirdparty%2Fgit.git gc: add tests for --cruft and friends In 5b92477f89 (builtin/gc.c: conditionally avoid pruning objects via loose, 2022-05-20) gc learned to respect '--cruft' and 'gc.cruftPacks'. '--cruft' is exercised in t5329-pack-objects-cruft.sh, but in a way that doesn't check whether a lone gc run generates these cruft packs. 'gc.cruftPacks' is never exercised. Add some tests to exercise these options to gc in the gc test suite. Signed-off-by: Emily Shaffer Signed-off-by: Taylor Blau Signed-off-by: Junio C Hamano --- diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index cd6c53360d..928a522194 100755 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@ -202,6 +202,49 @@ 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 ' +prepare_cruft_history () { + test_commit base && + + test_commit --no-tag foo && + test_commit --no-tag bar && + git reset HEAD^^ +} + +assert_cruft_packs () { + find .git/objects/pack -name "*.mtimes" >mtimes && + sed -e 's/\.mtimes$/\.pack/g' mtimes >packs && + + test_file_not_empty packs && + while read pack + do + test_path_is_file "$pack" || return 1 + done