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

Re: Add comment lines to patch format

From
Jeff King <peff@peff.net>
Date
May 19, 2012, 00:14 UTC
Message-ID
<20120519001410.GC765@sigill.intra.peff.net>
In-Reply-To
<20120518132228.GA27970@do>
On Fri, May 18, 2012 at 08:22:28PM +0700, Nguyen Thai Ngoc Duy wrote:
Show 8 quoted lines
> One thing is trailing space, like demonstrated in the patch below,
> because trailing spaces may be intentional sometimes. But I'd like to
> incorporate some word-diff goodness in patch format using this comment
> line to spot few/single character addition/removal.
> [...]
> If anyone knows a tool with similar feature, I'd greatly appreciate it
> (as the Internet taught me, everything I think of is already thought
> of/implemented by someone)
Have you looked at contrib/diff-highlight?

I think your approach is interesting because it can annotate much more than just "this part is interesting". Sometimes when I send a patch, I'd like to be able to comment in-line, like:

  +       if (bar > 3)
  +               foo(bar);
  = Yeah, this magic "3" is ugly, and we should handle it
  = through $whatever in the re-roll.
  +       else
  +               something_else();

I usually just write something in the cover letter, or reply to myself with comments inline. I don't know how much I would use it in practice, but it might be a neat thing for "git apply" to simply ignore comment lines in the middle of a hunk.

Of course, this feature might not be worth breaking compatibility with every existing version of "git apply" and "patch" out there.

-Peff
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 4 of 5 in “Add comment lines to patch format”
  1. Nguyen Thai Ngoc DuyMay 18, 2012
  2. Junio C HamanoMay 18, 2012
  3. Nguyen Thai Ngoc DuyMay 19, 2012
  4. Jeff KingMay 19, 2012
  5. Nguyen Thai Ngoc DuyMay 19, 2012

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.