From: "Luca Weiss" <luca@z3ntu.xyz>
To: <git@vger.kernel.org>
Subject: git interpret-trailers: behavior with input without trailing newline
Date: Thu, 08 Jul 2021 10:33:46 +0000 [thread overview]
Message-ID: <CCNOOVFJVMLC.7L79PCH59K1C@arch-vps> (raw)
[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]
Hi all,
I'm investigating a behavior with git interpret-trailers where when the input does not end with a newline, git appends the trailer directly without a newline; and on running the same command again it doesn't detect the previous trailer anymore.
I've whipped up a quick PoC in form of a new test case in the existing test cases of git.
Appending the patch here (sorry if it does get corrupted from my editor, but I hope you get the gist of it).
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index 04885d0a5e..602725f939 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -17,6 +17,7 @@ test_expect_success 'setup' '
body
EOF
+ printf "subject\n\nbody" > basic_message_no_eol &&
cat >complex_message_body <<-\EOF &&
my subject
@@ -676,6 +677,12 @@ test_expect_success 'with message that has an old style conflict block' '
test_cmp expected actual
'
+test_expect_success 'bla blub' '
+ git interpret-trailers --trailer "Cc: Peff" basic_message_no_eol > intermediary &&
+ git interpret-trailers --trailer "Cc: Peff" intermediary > actual9 &&
+ test_cmp intermediary actual9
+'
+
test_expect_success 'with commit complex message and trailer args' '
cat complex_message_body >expected &&
sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
It doesn't feel like an expected behavior but if it is, please tell me.
Regards
Luca
next reply other threads:[~2021-07-08 10:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 10:33 Luca Weiss [this message]
2021-07-13 0:35 ` git interpret-trailers: behavior with input without trailing newline Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CCNOOVFJVMLC.7L79PCH59K1C@arch-vps \
--to=luca@z3ntu.xyz \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).