t/t6501-freshen-objects.sh: prepare for gc --cruft by default

In a similar spirit as previous commits, prepare for `gc --cruft`
becoming the default by ensuring that the tests in t6501 explicitly
cover the case of freshening loose objects not using cruft packs.

We could run this test twice, once with `--cruft` and once with
`--no-cruft`, but doing so is unnecessary, since we already test object
rescuing, freshening, and dealing with corrupt parts of the unreachable
object graph extensively via t5329.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau 2023-04-18 16:40:43 -04:00 committed by Junio C Hamano
parent b934207a22
commit b31d45b831

View File

@ -101,7 +101,7 @@ do
' '
test_expect_success "simultaneous gc ($title)" ' test_expect_success "simultaneous gc ($title)" '
git gc --prune=12.hours.ago git gc --no-cruft --prune=12.hours.ago
' '
test_expect_success "finish writing out commit ($title)" ' test_expect_success "finish writing out commit ($title)" '
@ -131,7 +131,7 @@ do
' '
test_expect_success "simultaneous gc ($title)" ' test_expect_success "simultaneous gc ($title)" '
git gc --prune=12.hours.ago git gc --no-cruft --prune=12.hours.ago
' '
# tree should have been refreshed by write-tree # tree should have been refreshed by write-tree
@ -151,7 +151,7 @@ test_expect_success 'do not complain about existing broken links (commit)' '
some message some message
EOF EOF
commit=$(git hash-object -t commit -w broken-commit) && commit=$(git hash-object -t commit -w broken-commit) &&
git gc -q 2>stderr && git gc --no-cruft -q 2>stderr &&
verbose git cat-file -e $commit && verbose git cat-file -e $commit &&
test_must_be_empty stderr test_must_be_empty stderr
' '
@ -161,7 +161,7 @@ test_expect_success 'do not complain about existing broken links (tree)' '
100644 blob $(test_oid 003) foo 100644 blob $(test_oid 003) foo
EOF EOF
tree=$(git mktree --missing <broken-tree) && tree=$(git mktree --missing <broken-tree) &&
git gc -q 2>stderr && git gc --no-cruft -q 2>stderr &&
git cat-file -e $tree && git cat-file -e $tree &&
test_must_be_empty stderr test_must_be_empty stderr
' '
@ -176,7 +176,7 @@ test_expect_success 'do not complain about existing broken links (tag)' '
this is a broken tag this is a broken tag
EOF EOF
tag=$(git hash-object -t tag -w broken-tag) && tag=$(git hash-object -t tag -w broken-tag) &&
git gc -q 2>stderr && git gc --no-cruft -q 2>stderr &&
git cat-file -e $tag && git cat-file -e $tag &&
test_must_be_empty stderr test_must_be_empty stderr
' '