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

Re: [PATCH v1 1/3] Introduce config variable "diff.primer"

From
Jeff King <peff@peff.net>
Date
Jan 26, 2009, 03:12 UTC
Message-ID
<20090126031206.GB14277@sigill.intra.peff.net>
In-Reply-To
<alpine.GSO.2.00.0901251345240.12651@kiwi.cs.ucla.edu>
On Sun, Jan 25, 2009 at 06:40:02PM -0800, Keith Cascio wrote:
Show 6 quoted lines
> I agree opt-in is always better with new grammar/semantics.  However,
> the constraint I was trying to live inside is: if I call "git diff" on
> the command line with no options at all, then primer active.  Yet
> perhaps that's not possible, and the only way to do primer is to
> require opt-in spelled "--primer".  Then I can tell bash to alias
> 'gitdiff' as 'git diff --primer' and use that on the command line.

What's the point of aliasing something that isn't "git diff" to "git diff --primer"? At that point, couldn't you just do away with --primer entirely and alias "gitdiff" to "git diff --whatever --your --primer --options --are"?

Anyway, I think that isn't necessary. We _do_ have a mechanism to handle this already: some commands are plumbing, and must have stable interfaces, and some commands are porcelain, and can do your magic automatically. For example, gitk doesn't actually call "git diff"; it calls "git diff-tree", "git diff-index", etc.

So if you just want this from the command line, then I think it is safe to have "git diff" always respect "diff.primer", and scripts shouldn't be impacted.

But this can break down in two ways:
  1. Sometimes we blur the line of plumbing and porcelain, where
     functionality is available only through plumbing. For example,
     gitweb until recently called "git diff" because there is no other
     way to diff two arbitrary blobs. But the solution there is, I
     think, to make that functionality available through plumbing. Not
     to disallow enhancements to porcelain.
  2. When you want a script to take advantage of porcelain-like options,
     the situation is much more difficult (and this is what Junio was
     talking about in his last mail).
     What I think is sane is:
       a. You grow new feature X.
       b. Porcelain takes advantage of any config that asks us to use X.
       c. Plumbing does _not_ respect such config, but will respect
          command line options.
       d. Scripts control which command line options they use; when the
          script writer decides feature X will not interfere (either
          because it is harmless to the script's use, or because the
          script is enhanced to handle the new behavior), then it can
          pass an "--allow-X" command line option.
     And of course that has two disadvantages (and I'm running out of
     numbering schemes):
       I. You have to wait for the script to be updated before you can
          start using X, even if _you_ know that it's harmless.
      II. Point (d) is not always true. Junio mentioned the fact that
          gitk passes command line parameters blindly to rev-list, which
          is potentially unsafe. Up until now, our attitude has been "if
          it hurts, don't do it". In other words, if you call "gitk
          --reverse" and it looks ugly, then it is your fault. :)
-Peff
Previous: Keith CascioNext: Junio C Hamano
Message 20 of 41 in “Introduce config variable "diff.primer"”
  1. 0/3 Introduce config variable "diff.primer"Keith Cascio, Jan 25, 2009
  2. 1/3 Introduce config variable "diff.primer"Keith Cascio, Jan 25, 2009
  3. 2/3 Test functionality of new config variable "diff.primer"Keith Cascio, Jan 25, 2009
  4. 3/3 git-gui hooks for new config variable "diff.primer"Keith Cascio, Jan 25, 2009
  5. Johannes SchindelinJan 25, 2009
  6. Keith CascioJan 25, 2009
  7. Johannes SchindelinJan 25, 2009
  8. Keith CascioJan 25, 2009
  9. Johannes SchindelinJan 25, 2009
  10. Keith CascioJan 25, 2009
  11. Jeff KingJan 25, 2009
  12. Keith CascioJan 25, 2009
  13. Jeff KingJan 25, 2009
  14. Junio C HamanoJan 25, 2009
  15. Junio C HamanoJan 26, 2009
  16. Keith CascioJan 26, 2009
  17. Jeff KingJan 26, 2009
  18. Junio C HamanoJan 26, 2009
  19. Keith CascioJan 26, 2009
  20. Jeff KingJan 26, 2009
  21. Junio C HamanoJan 26, 2009
  22. Jeff KingJan 26, 2009
  23. Johannes SchindelinJan 26, 2009
  24. Jeff KingJan 26, 2009
  25. backwards compatibility, was Re: [PATCH v1 1/3] Introduce config variable "diff.primer"Johannes Schindelin, Jan 26, 2009
  26. Jeff KingJan 26, 2009
  27. Johannes SchindelinJan 26, 2009
  28. Jeff KingJan 26, 2009
  29. Keith CascioJan 27, 2009
  30. Jay SoffianJan 26, 2009
  31. Jeff KingJan 26, 2009
  32. Jay SoffianJan 26, 2009
  33. Junio C HamanoJan 26, 2009
  34. Jay SoffianJan 26, 2009
  35. Jeff KingJan 26, 2009
  36. Junio C HamanoJan 26, 2009
  37. Junio C HamanoJan 25, 2009
  38. Keith CascioJan 25, 2009
  39. Jeff KingJan 25, 2009
  40. Keith CascioJan 27, 2009
  41. Jeff KingJan 27, 2009

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.