Re: [PATCH] format-patch: show 0/1 and 1/1 for singleton patch with cover letter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 23, 2016 at 2:21 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Junio C Hamano <gitster@xxxxxxxxx> 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.

> 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

>  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 */
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]