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

Re: Project idea: github-like diff view

From
Jeff King <peff@peff.net>
Date
Apr 22, 2014, 15:59 UTC
Message-ID
<20140422155901.GA13663@sigill.intra.peff.net>
In-Reply-To
<CACsJy8DnJeZ-43Ydg_j00CO6=6NOA1wdzQ+EwCX6idrUOLn8gA@mail.gmail.com>
On Tue, Apr 22, 2014 at 04:59:17PM +0700, Duy Nguyen wrote:
Show 13 quoted lines
> On Sun, Apr 20, 2014 at 9:46 PM, Jeff King <peff@peff.net> wrote:
> > On Sun, Apr 20, 2014 at 04:58:28PM +0700, Duy Nguyen wrote:
> >
> >> - --color-words within unified diff format, using background color to
> >> show what part of the line has changed. This is only enabled for
> >> 1-line changes.
> >
> > See contrib/diff-highlight.
> 
> Thanks. I'd rather have it built in core git still. I'll try to see if
> I can rewrite it in C. Else, any objection to promote it to a core
> helper and setup pager automatically? We can have a config key to turn
> it off, but if git diff is colored, then it could be on by default.

If you are going to write it as part of git, it would be interesting to try using a real word-diff to find the inter-line changes, instead of the "front and back match" heuristic that the script uses. I know there are some cases that would look better, like:

  -foo(buf, len);
  +foo(obj->buf, obj->len);

but I suspect some cases would also look worse. It would be interesting to experiment with, though.

-Peff
Previous: Duy NguyenNext: Felipe Contreras
Message 4 of 5 in “Project idea: github-like diff view”
  1. Duy NguyenApr 20, 2014
  2. Jeff KingApr 20, 2014
  3. Duy NguyenApr 22, 2014
  4. Jeff KingApr 22, 2014
  5. Felipe ContrerasApr 22, 2014

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.