Re: [PATCH] format-patch: show 0/1 and 1/1 for singleton patch with cover letter
- From
Jacob Keller <jacob.keller@gmail.com>
- Date
- Aug 23, 2016, 21:28 UTC
- Message-ID
- <CA+P7+xqSurMJG7+z7yZGxpfuYWAuoZggQ_09KLiPBAs5E6yxZA@mail.gmail.com>
- In-Reply-To
- <xmqqinuruqpk.fsf@gitster.mtv.corp.google.com>
On Tue, Aug 23, 2016 at 2:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: >>> total = nr; >>> - if (!keep_subject && auto_number && total > 1) >>> + if (!keep_subject && auto_number && (total > 1 || cover_letter)) >>> numbered = 1; >>> if (numbered) >>> rev.total = total + start_number - 1; > > Actually there is a very good reason why this patch is not good > (yet). When the --cover option is not specified on the command > line, cover_letter is -1 (use configuration or turn it on only when > it is a multi-patch series) at this point. > > I think you would have noticed it if you ran any format-patch tests. > t/t4021-format-patch-numbered.sh fails at the very beginning. >
Oops! Sorry for not running tests.
Show 5 quoted lines
> With the attached SQUASH, existing tests pass, which is a strong > sign that this new feature needs to be protected by a new test in > the t4021 script to make sure other people would not break it in the > future. >
I'll add a new test and squash your fix in.
Thanks, Jake
Show 28 quoted lines
> builtin/log.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index e50d361..b7bfeb9 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -1650,16 +1650,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> /* nothing to do */
> return 0;
> total = nr;
> - if (!keep_subject && auto_number && (total > 1 || cover_letter))
> - numbered = 1;
> - if (numbered)
> - rev.total = total + start_number - 1;
> if (cover_letter == -1) {
> if (config_cover_letter == COVER_AUTO)
> cover_letter = (total > 1);
> else
> cover_letter = (config_cover_letter == COVER_ON);
> }
> + if (!keep_subject && auto_number && (total > 1 || cover_letter))
> + numbered = 1;
> + if (numbered)
> + rev.total = total + start_number - 1;
>
> if (!signature) {
> ; /* --no-signature inhibits all signatures */