From: Junio C Hamano <gitster@pobox.com>
To: John Keeping <john@keeping.me.uk>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] format-patch: output header for empty commits
Date: Fri, 03 Mar 2023 09:13:27 -0800 [thread overview]
Message-ID: <xmqqwn3xg3m0.fsf@gitster.g> (raw)
In-Reply-To: <20230303160301.3659328-1-john@keeping.me.uk> (John Keeping's message of "Fri, 3 Mar 2023 16:03:01 +0000")
John Keeping <john@keeping.me.uk> writes:
> When formatting an empty commit, it is surprising that a totally empty
> file is generated. Set the flag to always print the header, matching
> the behaviour of git-log.
Don't these empty files help send-email as safety against sending
them out? Unless existing tools depend on the current behaviour in
such a way, I think this is quite a sensible change.
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index f3313b8c58..ffc7c60680 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -59,6 +59,10 @@ test_expect_success setup '
> test_tick &&
> git commit -m "patchid 3" &&
>
> + git checkout -b empty main &&
> + test_tick &&
> + git commit --allow-empty -m "empty commit" &&
> +
> git checkout main
> '
>
> @@ -128,6 +132,12 @@ test_expect_success 'replay did not screw up the log message' '
> grep "^Side .* with .* backslash-n" actual
> '
>
> +test_expect_success 'format-patch empty commit' '
> + git format-patch --stdout main..empty >empty &&
> + grep "^From " empty >from &&
> + test_line_count = 1 from
> +'
> +
> test_expect_success 'extra headers' '
> git config format.headers "To: R E Cipient <rcipient@example.com>
> " &&
next prev parent reply other threads:[~2023-03-03 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 16:03 [PATCH] format-patch: output header for empty commits John Keeping
2023-03-03 17:13 ` Junio C Hamano [this message]
2023-03-04 10:45 ` John Keeping
2023-03-06 17:08 ` Junio C Hamano
2023-03-08 20:33 ` John Keeping
2023-03-08 20:43 ` 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=xmqqwn3xg3m0.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=john@keeping.me.uk \
/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).