Skip to content

Commit 5632baf

Browse files
peffgitster
authored andcommitted
t1450: check large blob in trailing-garbage test
Commit cce044d (fsck: detect trailing garbage in all object types, 2017-01-13) added two tests of trailing garbage in a loose object file: one with a commit and one with a blob. The point of having two is that blobs would follow a different code path that streamed the contents, instead of loading it into a buffer as usual. At the time, merely being a blob was enough to trigger the streaming code path. But since 7ac4f3a (fsck: actually fsck blob data, 2018-05-02), we now only stream blobs that are actually large. So since then, the streaming code path is not tested at all for this case. We can restore the original intent of the test by tweaking core.bigFileThreshold to make our small blob seem large. There's no easy way to externally verify that we followed the streaming code path, but I did check before/after using a temporary debug statement. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9752ad0 commit 5632baf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t1450-fsck.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,13 @@ test_expect_success 'fsck detects trailing loose garbage (commit)' '
636636
test_i18ngrep "garbage.*$commit" out
637637
'
638638

639-
test_expect_success 'fsck detects trailing loose garbage (blob)' '
639+
test_expect_success 'fsck detects trailing loose garbage (large blob)' '
640640
blob=$(echo trailing | git hash-object -w --stdin) &&
641641
file=$(sha1_file $blob) &&
642642
test_when_finished "remove_object $blob" &&
643643
chmod +w "$file" &&
644644
echo garbage >>"$file" &&
645-
test_must_fail git fsck 2>out &&
645+
test_must_fail git -c core.bigfilethreshold=5 fsck 2>out &&
646646
test_i18ngrep "garbage.*$blob" out
647647
'
648648

0 commit comments

Comments
 (0)