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

Re: [BUG] incorrect line numbers reported in git am

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 3, 2019, 22:56 UTC
Message-ID
<xmqqpnjda16c.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACsJy8CZCdF-jPeYaAxzpnSbtxbRX42ScSJyYFCfmxZ0YBhZGg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 13 quoted lines
> On Thu, Oct 3, 2019 at 7:52 AM Junio C Hamano <gitster@pobox.com> wrote:
>> > In fact, running `git am --show-current-patch` shows the whole mail, not
>> > only the 'patch' file so users would have no reason to expect the line
>> > numbers to refer to the 'patch' file.
>>
>> Yeah, show-current-patch was a misguided attempt to hide useful
>> information from the users.
>
> Not so much hiding as not having the information to present, at least
> not the easy way, since the mail is split at the beginning of git-am
> and never stored in $GIT_DIR. By the time this command is run, the
> mail is already gone. Someone could of course update git-am to keep a
> copy of the mail and improve this option.

By "hiding", I meant "rob from the users an opportunity to learn where the useful patch file is stored".

You seem to be doubly confused in this case, in that (1) you seem to have mistaken that I was complaining about show-current-patch not giving the full information contained in the original e-mail, and (2) you seem to think show-current-patch gives the contents of the patch witout other e-mail cruft. Both are incorrect.

The first thing the command does is to feed the input to mailsplit and store the results in numbered files "%04d", and they are not removed until truly done. When you need to inspect the patch that does not apply, they are still there. Even emails for those steps that have been successfully applied before the current one are also there (the split files are all gone, though, but they no longer matter as they have been applied fine).

I wouldn't have been so critical if "git am --show-current-patch" were implemented as "cat $GIT_DIR/rebase-apply/patch", but it does an equivalent of "cd $GIT_DIR/rebase-apply; cat $(cat next)" which is much less useful when trying to fix up the patch text that does not apply.

Previous: Duy NguyenNext: Denton Liu
Message 8 of 12 in “[BUG] incorrect line numbers reported in git am”
  1. Denton LiuOct 2, 2019
  2. Junio C HamanoOct 2, 2019
  3. Denton LiuOct 2, 2019
  4. Junio C HamanoOct 2, 2019
  5. Denton LiuOct 2, 2019
  6. Junio C HamanoOct 3, 2019
  7. Duy NguyenOct 3, 2019
  8. Junio C HamanoOct 3, 2019
  9. apply: tell user location of corrupted patch fileDenton Liu, Oct 4, 2019
  10. Junio C HamanoOct 5, 2019
  11. Junio C HamanoOct 5, 2019
  12. Junio C HamanoOct 5, 2019

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.