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

Re: [PATCH v2 1/2] Allow git-apply to ignore the hunk headers

From
SOSergei Organov <osv@javad.com>
Date
Jun 6, 2008, 10:33 UTC
Message-ID
<87iqwmzwcn.fsf@osv.gnss.ru>
In-Reply-To
<7v4p87zcv6.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 23 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>>> And the robustness issue I worry about the second point also applies to 
>>> a line that is "^-- $", especially if we were to make this available to 
>>> git-am.  Perhaps when the line begins with a '-', the logic could be 
>>> extra careful to detect the case where the line looks like the e-mail 
>>> signature separator and check one line beyond it to see if it does not 
>>> look anything like part of a diff (in which case you stop, without 
>>> considering the line you are currently looking at, "^-- $", a deletion 
>>> of "^- $", as part of the preimage context).
>>
>> Is this really an issue?  fixup_counts() is only called after a hunk 
>> header was read, and that should be well after any "^-- $".
>
> Are you talking about "^-- $" or "^---$"?  Yes we are way past the
> three-dash separator at this point, but e-mail signature separator happens
> at the very end after the patch.
>
> You read a hunk header line "@@ -l,m +n,o @@", and start counting the diff
> text because you do not trust m and o.  When you read the last hunk in a
> patch e-mail, you may hit a e-mail signature separator, like what is given
> by format-patch output at the end.  Mistaking that as an extra preimage
> context to remove "^- $" is what I was worried about.

Don't you think it's time to fix git-format-patch to put some reliable "end-of-patch" marker line before the signature? This change (along with refusal to generate brain-damaged empty lines inside hunks) will make git diffs easily parseable without information from hunk headers.

-- Sergei.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 34 of 39 in “Allow git-apply to fix up the line counts”
  1. 1/2 Allow git-apply to fix up the line countsJohannes Schindelin, Jun 5, 2008
  2. 2/2 git-add: introduce --edit (to edit the diff vs. the index)Johannes Schindelin, Jun 5, 2008
  3. Johannes SixtJun 5, 2008
  4. Johannes SchindelinJun 5, 2008
  5. Johannes SixtJun 5, 2008
  6. Johannes SchindelinJun 5, 2008
  7. Johannes SixtJun 5, 2008
  8. Johannes SchindelinJun 5, 2008
  9. Johannes SixtJun 5, 2008
  10. 0/2 git add --editJohannes Schindelin, Jun 5, 2008
  11. 1/2 Allow git-apply to ignore the hunk headersJohannes Schindelin, Jun 5, 2008
  12. Junio C HamanoJun 5, 2008
  13. Johannes SchindelinJun 5, 2008
  14. 0/2 git add --editJohannes Schindelin, Jun 5, 2008
  15. 1/2 Allow git-apply to ignore the hunk headers (AKA recountdiff)Johannes Schindelin, Jun 5, 2008
  16. Junio C HamanoJun 6, 2008
  17. Johannes SchindelinJun 6, 2008
  18. Junio C HamanoJun 6, 2008
  19. Junio C HamanoJun 6, 2008
  20. Johannes SchindelinJun 6, 2008
  21. Junio C HamanoJun 6, 2008
  22. Johannes SchindelinJun 6, 2008
  23. Govind SalinasJun 6, 2008
  24. Johannes SchindelinJun 6, 2008
  25. 2/2 git-add: introduce --edit (to edit the diff vs. the index)Johannes Schindelin, Jun 5, 2008
  26. Olivier MarinJun 6, 2008
  27. Johannes SchindelinJun 6, 2008
  28. Junio C HamanoJun 6, 2008
  29. Johannes SchindelinJun 6, 2008
  30. Junio C HamanoJun 5, 2008
  31. Johannes SchindelinJun 5, 2008
  32. Paolo BonziniJun 6, 2008
  33. Johannes SchindelinJun 6, 2008
  34. Sergei OrganovJun 6, 2008
  35. Johannes SchindelinJun 6, 2008
  36. Junio C HamanoJun 6, 2008
  37. 2/2 git-add: introduce --edit (to edit the diff vs. the index)Johannes Schindelin, Jun 5, 2008
  38. Pieter de BieJun 5, 2008
  39. Junio C HamanoJun 5, 2008

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.