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

Re: [PATCH] Don't add To: recipients to the Cc: header

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 20, 2007, 20:21 UTC
Message-ID
<7vr6ikk6rf.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<87ejekzpx3.fsf@osv.gnss.ru>
Sergei Organov <osv@javad.com> writes:
Show 8 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> [...]
>> Oops, forgot to say "no need to resend".  I asked only because I
>> wanted an independent datapoint for Emacs diff mode breakage.
>
> I bet I can damage any patch using any editor ;)
>
> More interesting is what version of Emacs it was?

To be fair and honest, I do not think there is a simple fix for this, although it probably is possible to fix it.

What is causing the "breakage" is the fact that format-patch output ends with the signature delimiter line "^-- $" that immediately follows the patch text. The number of preimage lines recorded in the hunk header of course does not initially count it, but you are asking the diff editing mode to help you edit the patch.

In diff editing mode, you can not only edit the contents of postimage lines, but also add and delete the preimage and postimage lines, and the diff editimg mode recounts the lines and adjusts the number of lines recorded in the hunk header when you do it. It is very handy if it worked reliably (and often it does).

But if you edit the last hunk of the format-patch output, unless the editor very carefully keeps track of what you edited and what was in the original, it is understandable that it would mistake the signature delimiter line as the last preimage line that is "^- $", and ends up miscounting the length of the hunk.

The signature delimiter was there from the beginning in the patch file, but outside of the hunk in question. We could argue that it is a bug to mistake that as a preimage line added by the user (after all the editor knows what was modified and what was from the beginning), but it still is understandable.

Previous: Sergei OrganovNext: Sergei Organov
Message 7 of 14 in “Don't add To: recipients to the Cc: header”
  1. Don't add To: recipients to the Cc: headerAsk Bjørn Hansen, Nov 19, 2007
  2. Ask Bjørn HansenNov 19, 2007
  3. Junio C HamanoNov 20, 2007
  4. Ask Bjørn HansenNov 20, 2007
  5. Junio C HamanoNov 20, 2007
  6. Sergei OrganovNov 20, 2007
  7. Junio C HamanoNov 20, 2007
  8. Sergei OrganovNov 23, 2007
  9. Junio C HamanoNov 23, 2007
  10. Sergei OrganovNov 23, 2007
  11. Junio C HamanoNov 23, 2007
  12. Sergei OrganovNov 26, 2007
  13. Junio C HamanoNov 26, 2007
  14. Sergei OrganovNov 26, 2007

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.