mirror of
https://github.com/git/git.git
synced 2024-12-12 03:14:11 +08:00
t1007: modernize malformed object tests
The tests in t1007 for detecting malformed objects have two anachronisms: - they use "sha1" instead of "oid" in variable names, even though the script as a whole has been adapted to handle sha256 - they use test_i18ngrep, which is no longer necessary Since we'll be adding a new similar test, let's clean these up so they are all consistently using the modern style. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
37537d6472
commit
6e2646075c
@ -203,23 +203,23 @@ done
|
||||
test_expect_success 'too-short tree' '
|
||||
echo abc >malformed-tree &&
|
||||
test_must_fail git hash-object -t tree malformed-tree 2>err &&
|
||||
test_i18ngrep "too-short tree object" err
|
||||
grep "too-short tree object" err
|
||||
'
|
||||
|
||||
test_expect_success 'malformed mode in tree' '
|
||||
hex_sha1=$(echo foo | git hash-object --stdin -w) &&
|
||||
bin_sha1=$(echo $hex_sha1 | hex2oct) &&
|
||||
printf "9100644 \0$bin_sha1" >tree-with-malformed-mode &&
|
||||
hex_oid=$(echo foo | git hash-object --stdin -w) &&
|
||||
bin_oid=$(echo $hex_oid | hex2oct) &&
|
||||
printf "9100644 \0$bin_oid" >tree-with-malformed-mode &&
|
||||
test_must_fail git hash-object -t tree tree-with-malformed-mode 2>err &&
|
||||
test_i18ngrep "malformed mode in tree entry" err
|
||||
grep "malformed mode in tree entry" err
|
||||
'
|
||||
|
||||
test_expect_success 'empty filename in tree' '
|
||||
hex_sha1=$(echo foo | git hash-object --stdin -w) &&
|
||||
bin_sha1=$(echo $hex_sha1 | hex2oct) &&
|
||||
printf "100644 \0$bin_sha1" >tree-with-empty-filename &&
|
||||
hex_oid=$(echo foo | git hash-object --stdin -w) &&
|
||||
bin_oid=$(echo $hex_oid | hex2oct) &&
|
||||
printf "100644 \0$bin_oid" >tree-with-empty-filename &&
|
||||
test_must_fail git hash-object -t tree tree-with-empty-filename 2>err &&
|
||||
test_i18ngrep "empty filename in tree entry" err
|
||||
grep "empty filename in tree entry" err
|
||||
'
|
||||
|
||||
test_expect_success 'corrupt commit' '
|
||||
|
Loading…
Reference in New Issue
Block a user