Re: [PATCH] format-patch: use raw format for notes

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

 



Tuomas Ahola <taahol@xxxxxx> writes:

> The default formatting of commit notes by git format-patch --notes
> doesn't make a very good fit.  It would be more beneficial to use the
> raw format for CMIT_FMT_EMAIL and CMIT_FMT_MBOXRD.

Hmph.  That is unfortunately quite subjective.  "doesn't make a very
good fit" why?  "more benefitial" why?

And it turns out that using "raw" is not a good choice in the
context of e-mailed patches.  Read on.

> Signed-off-by: Tuomas Ahola <taahol@xxxxxx>
> ---
>  log-tree.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/log-tree.c b/log-tree.c
> index 8b184d6776..c40a7599d0 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -857,7 +857,9 @@ void show_log(struct rev_info *opt)
>  		int raw;
>  		struct strbuf notebuf = STRBUF_INIT;
>  
> -		raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
> +		raw = (opt->commit_format == CMIT_FMT_USERFORMAT ||
> +		       opt->commit_format == CMIT_FMT_EMAIL ||
> +		       opt->commit_format == CMIT_FMT_MBOXRD);

After applying this patch and running

    $ git format-patch --notes=amlog -1

(where refs/notes/amlog holds commit to original e-mail mapping), I
get this:

    ...
    Subject: [PATCH] format-patch: use raw format for notes

    ...
    Signed-off-by: Tuomas Ahola <taahol@xxxxxx>
    Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
    ---

    Notes (amlog):
        Message-Id: <20250318180251.3712-1-taahol@xxxxxx>

     log-tree.c | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    ...

But with this patch in place, I instead get this:

    ...
    Subject: [PATCH] format-patch: use raw format for notes

    ...
    Signed-off-by: Tuomas Ahola <taahol@xxxxxx>
    Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
    ---
    Message-Id: <20250318180251.3712-1-taahol@xxxxxx>

     log-tree.c | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    ...

There is no indication where the note came from, and more
importantly, the contents of the note loses its crucial leading
spaces that makes sure that any random lines in the note that happen
to begin with "diff", "---", etc. are not mistaken as the beginning
of the first patch.

So, no, this change is not a good thing to do, at least in its
current form.  Besides, unconditional change like this will break
existing users.





[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]

  Powered by Linux