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