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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 26, 2009, 02:30 UTC
Message-ID
<7v1vuqdcjp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7v1vurf7lq.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Scriptability by definition means you do not know how scripts written by
> people around plumbing use the output; I do not think you can sensibly say
> "this should not be turned on in a machine friendly output, but this is
> safe to use".
>
> I would not be opposed to an enhancement to the plumbing that the scripts
> can use to say "I am willing to take any option (or perhaps "these
> options") given to me via diff.primer".  Some scripts may want to be just
> a pass-thru of whatever the underlying git-diff-* command outputs, and it
> may be a handy way to magically upgrade them to allow their invocation of
> lowlevel plumbing to be affected by what the end-user configured.  But
> that magic upgrade has to be an opt/in process.

I suspect it is pretty much orthogonal to the "use user's default without being told from the command line", but it might be a worthy goal to introduce a mechanism for the scripts to accept "safe" default options from the end user while rejecting undesirable ones that would interfere with the way it uses plumbing.

For example, gitk drives "git rev-list" and many options you give from the command line (e.g. "gitk --all --simplify-merges -- drivers/") are passed to the underlying plumbing.

This is a double edged sword. When we add new features to git-rev-list, (e.g. --simplify-merges or --simplify-by-decoration are fairly recent inventions that did not exist when gitk was written originally), some of them can be safely passed and automagically translates to a new feature in gitk. However, use of some options (e.g. --reverse) breaks the assumption the tool makes on the output from the underlying plumbing and should not be accepted from the end-user.

It would be a good addition to our toolset if scripts like gitk can declare which options and features are safe to accept from the end user to pass down to the plumbing tools. "git rev-parse", which lets the script sift between options that are meant to affect ancestry traversal and the ones that are for other (primarily diff family) commands, does not do anything fancy like that, but it would be a logical place to do this sort of thing.

And it is not limited to "scripts" use. A recent topic on rejecting colouring options from being given to format-patch would also be helped with such a mechanism if it is available to builtins.

Just an idle thought.
Previous: Junio C HamanoNext: Keith Cascio
Message 15 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.