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

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

From
Denton Liu <liu.denton@gmail.com>
Date
Oct 2, 2019, 20:16 UTC
Message-ID
<20191002201659.GB24697@generichostname>
In-Reply-To
<xmqq8sq2ewzh.fsf@gitster-ct.c.googlers.com>
On Thu, Oct 03, 2019 at 05:03:14AM +0900, Junio C Hamano wrote:
Show 11 quoted lines
> Denton Liu <liu.denton@gmail.com> writes:
> 
> > which is in the middle of the log message. I expect the line to be
> > reported as something in the range of 198-203,...
> 
> That comes from not knowing who is complaining and what it is
> reading.  In this case, "git apply" issues a warning because it is
> fed .git/rebase-apply/patch file, which is the output of mailinfo
> that parses header & log message out, leaves the message in a
> separate 'msg' file in the same directory and stores the rest in
> that 'patch' file.  And it is line 87 that has problems.

In this case, I would still regard this as a bug since users would expect the line 87 to refer to their input file. I think most users don't even realise that a .git/rebase-apply/patch file exists. (I certainly didn't.)

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.

I think it would make sense to pass the number of lines skipped by mailinfo to the apply step so that more accurate line numbers can be reported to users.

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 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.