[PATCH v5 0/1] cat-file: quote-format name in error when using -z
- From
Toon Claes <toon@iotcl.com>
- Date
- May 10, 2023, 19:01 UTC
- Message-ID
- <20230510190116.795641-1-toon@iotcl.com>
- In-Reply-To
- <xmqqilfhctrr.fsf@gitster.g>
This is the fifth revision of this patch. The code changes are identical to v3, but there was one comment[1] about adding test coverage for batch_object_write(). In v4 I tried another approach, but that didn't work well. So for this version I'm just adding the test to version 3 as requested. See below the range-diff against v3, ignoring v4 ever happened.
Kind regards, Toon
[1]: https://public-inbox.org/git/2a2a46f0-a9bc-06a6-72e1-28800518777c@dunelm.org.uk/
Toon Claes (1): cat-file: quote-format name in error when using -z
builtin/cat-file.c | 19 +++++++++++++++++++ t/t1006-cat-file.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+)
Range-diff against v3:
1: 16f7a123d8 ! 1: 14bccfa9fd cat-file: quote-format name in error when using -z
@@ t/t1006-cat-file.sh: test_expect_success FUNNYNAMES '--batch-check, -z with newl
+ printf "\"HEAD:newline\\\\nmissing\" missing\n" >expect &&
+ test_cmp expect actual
+'
++
++test_expect_success FUNNYNAMES '--batch-check, -z with missing object having newline in name' '
++ git init missing-object-newline &&
++ (
++ cd missing-object-newline &&
++ file="newline${LF}embedded" &&
++ echo_without_newline "hello" > $file &&
++ git add "$file" &&
++ git commit -m "file with newline embedded" &&
++ test_tick &&
++
++ sha1=$(git rev-parse HEAD:"$file") &&
++ rm .git/objects/$(test_oid_to_path $sha1) &&
++ printf "HEAD:$file" >in &&
++ git cat-file --batch-check -z <in >actual &&
++ printf "\"HEAD:newline\\\\nembedded\" missing\n" >expect &&
++ test_cmp expect actual
++ )
++'
+
batch_command_multiple_info="info $hello_sha1
info $tree_sha1
--
2.40.1