git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] cat-file: fix mailmap application for different author and committer

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 11, 2025, 09:38 UTC
Message-ID
<CAP8UFD1hBo_ZH1nyGBOoQOwx=44CfnkhEOHYu3_XMwSzXQAHdg@mail.gmail.com>
In-Reply-To
<20250611062643.8639-1-siddharthasthana31@gmail.com>
On Wed, Jun 11, 2025 at 8:27 AM <siddharthasthana31@gmail.com> wrote:
> Reported-by: Vasilii Iakliushin <viakliushin@gitlab.com>
> Reviewed-by: Christian Couder <christian.couder@gmail.com>
Nit: I reviewed it when you suggested it on a GitLab MR (Merge
Request), but I am not sure it counts unless I also review it here. I
think the "Reviewed-by: ..." trailer is for patches reviewed on the
regular Git mailing list (or maybe on the private Git security list).
So maybe "Helped-by: ..." would have been better in this case.
Anyway I have now reviewed it again and I found it great.
Thanks for working on this!
Show 18 quoted lines
> Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
> ---
>  ident.c            |  4 ++++
>  t/t4203-mailmap.sh | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/ident.c b/ident.c
> index 967895d885..281e830573 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -412,6 +412,10 @@ void apply_mailmap_to_header(struct strbuf *buf, const char **header,
>                                 found_header = 1;
>                                 buf_offset += endp - line;
>                                 buf_offset += rewrite_ident_line(person, endp - person, buf, mailmap);
> +                               /* Recompute endp after potential buffer reallocation */
> +                               endp = buf->buf + buf_offset;
> +                               if (*endp == '\n')
> +                                       buf_offset++;

Yeah, without this, in the next iteration of the `for (;;) { ... }` loop after the "author" header has been found, we have:

        line = buf->buf + buf_offset;

which sets `line` to something like "\ncommitter C O Mitter <committer@example.com> ...", and then:

        if (!*line || *line == '\n')
            return; /* End of headers */
which just returns as `*line` is indeed '\n'.
>                                 break;
>                         }
Previous: siddharthasthana31@gmail.comNext: Junio C Hamano
Message 2 of 10 in “cat-file: fix mailmap application for different author and committer”
  1. cat-file: fix mailmap application for different author and committersiddharthasthana31@gmail.com, Jun 11, 2025
  2. Christian CouderJun 11, 2025
  3. Junio C HamanoJun 12, 2025
  4. Junio C HamanoJun 11, 2025
  5. Eric SunshineJun 11, 2025
  6. Junio C HamanoJun 11, 2025
  7. Siddharth AsthanaJun 13, 2025
  8. cat-file: fix mailmap application for different author and committersiddharthasthana31@gmail.com, Jun 13, 2025
  9. Christian CouderJun 13, 2025
  10. Junio C HamanoJun 13, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.