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

Re: [RFD] Strange patch formats (aka tricks with unified diffs)..

From
Jeff King <peff@peff.net>
Date
Apr 14, 2007, 10:09 UTC
Message-ID
<20070414100923.GA6546@sigill.intra.peff.net>
In-Reply-To
<7vbqhrb7r2.fsf@assigned-by-dhcp.cox.net>
On Sat, Apr 14, 2007 at 02:55:13AM -0700, Junio C Hamano wrote:
> One sensible behaviour would be to show exactly the same output
> lines as the regular output, but color-code only the words that
> changed.  E.g (the words are capitalized to illustrate instead
> of colored here):

That works great for highlighting a small change between two very similar lines (and I think that is one use of --color-words). However, it's terrible for the other use of color words, which is showing changes which are not well-adapted to line oriented diffs (such as flowed text).

Try this:

cat >orig <<EOF this is a paragraph that has some text in it and is wrapped at 30 characters EOF

cat >rewrapped <<EOF this is yet another paragraph that has some text in it and is wrapped at 30 characters EOF

git-diff --color orig rewrapped git-diff --color-words orig rewrapped

I think one behavior is best for one situation, and the other behavior for another situation. Perhaps there is room for two modes?

-Peff
Previous: Junio C HamanoNext: Linus Torvalds
Message 11 of 16 in “[RFD] Strange patch formats (aka tricks with unified diffs)..”
  1. Linus TorvaldsApr 12, 2007
  2. Junio C HamanoApr 12, 2007
  3. Marco CostalbaApr 13, 2007
  4. Marco CostalbaApr 17, 2007
  5. Paul MackerrasApr 13, 2007
  6. Martin LanghoffApr 13, 2007
  7. Junio C HamanoApr 13, 2007
  8. Martin LanghoffApr 13, 2007
  9. Johannes SchindelinApr 14, 2007
  10. Junio C HamanoApr 14, 2007
  11. Jeff KingApr 14, 2007
  12. Linus TorvaldsApr 13, 2007
  13. Paul MackerrasApr 18, 2007
  14. Linus TorvaldsApr 18, 2007
  15. Matthias LederhoferApr 13, 2007
  16. Linus TorvaldsApr 13, 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.