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

Re: weird diff output?

From
Jeff King <peff@peff.net>
Date
Apr 15, 2016, 02:18 UTC
Message-ID
<20160415021829.GD22112@sigill.intra.peff.net>
In-Reply-To
<CAGZ79ka8pgPNZKaVWnsa_S07esxkN9nJfhcMZvCfd5U6MtsrYQ@mail.gmail.com>
On Thu, Apr 14, 2016 at 02:05:03PM -0700, Stefan Beller wrote:
Show 12 quoted lines
> > Looking over the code, I agree that xdl_change_compact() is the place we
> > would want to put it. We'd probably tie it to a command-line option and
> > let people play around with it, and then consider making it the default
> > if there's widespread approval.
> 
> I just stumbled upon
> http://blog.scoutapp.com/articles/2016/04/12/3-git-productivity-hacks
> which advertises git config --global pager.diff "diff-so-fancy | less
> --tabs=4 -RFX"
> 
> Would you consider your perl script good enough to put that instead of
> diff-so-fancy?

For some definition of "good enough". I don't plan to run it myself. And I don't use diff-so-fancy. But I think diff-so-fancy folks also tend to run contrib/diff-highlight, which is written in perl and quite similar in structure to what I posted earlier (unsurprisingly, since I wrote it).

So I think it works, and the performance hit from piping through perl generally isn't bad enough to be a problem (and by definition it's only running when you would run an interactive pager in the first place).

I don't think that this particular heuristic is in quite the same class as diff-highlight and diff-so-fancy, though. Those ones transform the diff away from something that can be applied, so you really do just want them for human viewing. But this new heuristic is something that you'd probably want as part of format-patch, for example, and we don't generally kick in the pager there. So I think it would be much more natural inside of the diff generation.

-Peff
Previous: Jacob Keller
Message 27 of 27 in “weird diff output?”
  1. Jacob KellerMar 29, 2016
  2. Stefan BellerMar 29, 2016
  3. Junio C HamanoMar 29, 2016
  4. Stefan BellerMar 29, 2016
  5. Jacob KellerMar 29, 2016
  6. Junio C HamanoMar 30, 2016
  7. Jeff KingMar 30, 2016
  8. Stefan BellerMar 30, 2016
  9. Jacob KellerMar 30, 2016
  10. Jacob KellerMar 30, 2016
  11. Jacob KellerMar 30, 2016
  12. Stefan BellerMar 30, 2016
  13. Junio C HamanoApr 1, 2016
  14. Jeff KingMar 31, 2016
  15. Jacob KellerApr 6, 2016
  16. Stefan BellerApr 12, 2016
  17. Davide LibenziApr 14, 2016
  18. Jeff KingApr 14, 2016
  19. Stefan BellerApr 14, 2016
  20. Implement better chunk heuristics.Stefan Beller, Apr 15, 2016
  21. Jacob KellerApr 15, 2016
  22. Stefan BellerApr 15, 2016
  23. Jacob KellerApr 15, 2016
  24. Junio C HamanoApr 15, 2016
  25. Stefan BellerApr 15, 2016
  26. Jacob KellerApr 15, 2016
  27. Jeff KingApr 15, 2016

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.