From: Taylor Blau <me@ttaylorr.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH 1/2] t1006: extract --batch-command inputs to variables
Date: Fri, 22 Jul 2022 19:29:02 -0400 [thread overview]
Message-ID: <7c1ad1f02285841d287445abe2ba9b4cb3d8a456.1658532524.git.me@ttaylorr.com> (raw)
In-Reply-To: <cover.1658532524.git.me@ttaylorr.com>
A future commit will want to ensure that various `--batch`-related
options produce the same output whether their input is newline
terminated, or NUL terminated (and a to-be-implemented `-z` option
exists).
To prepare for this, extract the given input(s) into separate variables
to that their LF characters can easily be converted into NUL bytes when
testing the new `-z` mode.
This is consistent with other tests in t1006 (which these days is no
longer a shining example of our CodingGuidelines).
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
t/t1006-cat-file.sh | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index dadf3b1458..01c0535765 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -418,6 +418,12 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
"$(echo_without_newline "$batch_check_input" | git cat-file --batch-check)"
'
+batch_command_multiple_info="info $hello_sha1
+info $tree_sha1
+info $commit_sha1
+info $tag_sha1
+info deadbeef"
+
test_expect_success '--batch-command with multiple info calls gives correct format' '
cat >expect <<-EOF &&
$hello_sha1 blob $hello_size
@@ -427,17 +433,18 @@ test_expect_success '--batch-command with multiple info calls gives correct form
deadbeef missing
EOF
- git cat-file --batch-command --buffer >actual <<-EOF &&
- info $hello_sha1
- info $tree_sha1
- info $commit_sha1
- info $tag_sha1
- info deadbeef
- EOF
+ echo "$batch_command_multiple_info" >in &&
+ git cat-file --batch-command --buffer <in >actual &&
test_cmp expect actual
'
+batch_command_multiple_contents="contents $hello_sha1
+contents $commit_sha1
+contents $tag_sha1
+contents deadbeef
+flush"
+
test_expect_success '--batch-command with multiple command calls gives correct format' '
remove_timestamp >expect <<-EOF &&
$hello_sha1 blob $hello_size
@@ -449,13 +456,8 @@ test_expect_success '--batch-command with multiple command calls gives correct f
deadbeef missing
EOF
- git cat-file --batch-command --buffer >actual_raw <<-EOF &&
- contents $hello_sha1
- contents $commit_sha1
- contents $tag_sha1
- contents deadbeef
- flush
- EOF
+ echo "$batch_command_multiple_contents" >in &&
+ git cat-file --batch-command --buffer <in >actual_raw &&
remove_timestamp <actual_raw >actual &&
test_cmp expect actual
--
2.37.0.1.g1379af2e9d
next prev parent reply other threads:[~2022-07-22 23:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 23:28 [PATCH 0/2] cat-file: support NUL-delimited input with `-z` Taylor Blau
2022-07-22 23:29 ` Taylor Blau [this message]
2022-07-22 23:29 ` [PATCH 2/2] builtin/cat-file.c: " Taylor Blau
2022-07-22 23:41 ` Chris Torek
2022-07-25 23:39 ` Taylor Blau
2022-07-23 5:17 ` Ævar Arnfjörð Bjarmason
2022-07-23 17:45 ` Junio C Hamano
2022-07-25 23:44 ` Taylor Blau
2022-07-27 14:10 ` Junio C Hamano
2022-07-23 5:35 ` Junio C Hamano
2022-07-25 23:50 ` Taylor Blau
2022-07-27 14:20 ` Junio C Hamano
2022-07-31 15:50 ` Phillip Wood
2022-08-11 11:52 ` Ævar Arnfjörð Bjarmason
2022-07-23 4:44 ` [PATCH 0/2] cat-file: " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c1ad1f02285841d287445abe2ba9b4cb3d8a456.1658532524.git.me@ttaylorr.com \
--to=me@ttaylorr.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).