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

Re: [PATCH 2/3] Documentation: Add diff.<driver>.* to config

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2011, 17:24 UTC
Message-ID
<7v1v1i9bft.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4D998736.2080901@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 7 quoted lines
>> ...
>> +diff.<driver>.xfuncname::
>> +	Defines the regular expression that the custom diff driver
>> +	should use to recognize the hunk header.  A built-in pattern
>> +	may also be used.  See linkgit:gitattributes[5] for details.
>
> The regular...
I agree with your "Defines..." comment.
Show 6 quoted lines
>> +diff.<driver>.binary::
>> +	Set this option to true to make the custom diff driver treat
>> +	files as binary.  See linkgit:gitattributes[5] for details.
>
> This has nothing to do with the diff driver's operation. It is about how
> git treats the result (the output from the diff driver):

In general, the use of "diff.<driver>.foo" is consistent with the current terminology, which is coming from the description of <driver> in the gitattributes documentation:

   `diff`
   ^^^^^^
   The attribute `diff` affects how 'git' generates diffs for particular
   files. It can tell git whether to generate a textual patch for the path
   or to treat the path as a binary file.  It can also affect...
   Set::
   ...
   String::
           Diff is shown using the specified diff driver.  Each driver may
           specify one or more options, as described in the following
           section. The options for the diff driver "foo" are defined
           by the configuration variables in the "diff.foo" section of the
           git config file.

When the 'diff' attribute was invented, its string value was meant to say more than "do generate diff for this path" (set) vs "don't generate diff for this path" (unset) by saying what _kind_ of file it is and switch the backend driver to generate diff based on that _kind_. We could call this "kind" a file-type, but that is a bit too broad a word; we are not talking about regular file vs symbolic link or executable vs non-executable. This is about letting us determine the type of the _content_ more explicitly than the case where the attribute is Unspecified and we inspect the content to determine the type. Perhaps we could have called this content-type but again that word has other established meaning.

In any case, as you point out, the description itself is not quite right from the end-user's point of view, even though it is correct at the implementation level.

This diff.<driver>.binary variable is a somewhat ugly workaround for content types that want to be treated as if they are binary while "diff" (usually you would say "-diff" in gitattributes file for such a path) works, but still want non-diff users (e.g. "cat-file --textconv") of the textconv filter to still apply the specified text conversion. In order to specify what text conversion to apply, you would need a content-type to do so, but once you specify a content-type, "diff" will not treat them as binary anymore, so you tell the "diff" machinery by setting this variable.

At the implementation level, you are telling the <driver>, which is defined as an array of operations indexed by content-types, to respond to requests to "diff" by producing "binary files differ", so in that sense, it is telling "the custom diff driver" to "treat files as binary".

Show 7 quoted lines
>> +diff.<driver>.textconv::
>> +	Defines the command that the custom diff driver should call to
>> +	generate the text-converted version of a binary file.  The
>> +	result of the conversion is used to generate a human-readable
>> +	diff.  See linkgit:gitattributes[5] for details.
>
> No, please! You don't need a custom diff driver for textconv.

Correct. Probably we should abolish "custom" from the above description. Also "binary" is unnecessary in "version of a binary file" above, as it is perfectly sensible to run ps2ascii for a text postscript file.

Show 11 quoted lines
>> +diff.<driver>.wordregex::
>> +	Defines the regular expression that the custom diff driver
>> +	should use to split words in a line.  See
>> +	linkgit:gitattributes[5] for details.
>> +
>> +diff.<driver>.cachetextconv::
>> +	Set this option to true to make the custom diff driver cache
>> +	the text conversion outputs.  See linkgit:gitattributes[5] for
>> +	details.
>
> Again, both are independent of a custom diff driver.
Just drop "custom".
> ... Maybe even <driver>
> is misleading here, I dunno.
Perhaps.  See the "file-type" and "content-type" discussion above.
Previous: Michael J GruberNext: Ramkumar Ramachandra
Message 11 of 33 in “Documentation: Document diff.<tool>.* and filter.<driver>.* in config”
  1. Documentation: Document diff.<tool>.* and filter.<driver>.* in configRamkumar Ramachandra, Apr 1, 2011
  2. Jakub NarebskiApr 1, 2011
  3. Documentation: Document diff.<tool>.* and filter.<driver>.* in configRamkumar Ramachandra, Apr 1, 2011
  4. Jakub NarebskiApr 1, 2011
  5. Michael J GruberApr 1, 2011
  6. 0/3 Document diff and filter drivers in configRamkumar Ramachandra, Apr 3, 2011
  7. 1/3 Documentation: Add filter.<driver>.* to configRamkumar Ramachandra, Apr 3, 2011
  8. Michael J GruberApr 4, 2011
  9. 2/3 Documentation: Add diff.<driver>.* to configRamkumar Ramachandra, Apr 3, 2011
  10. Michael J GruberApr 4, 2011
  11. Junio C HamanoApr 4, 2011
  12. 3/3 Documentation: Allow custom diff tools to be specified in 'diff.tool'Ramkumar Ramachandra, Apr 3, 2011
  13. Michael J GruberApr 4, 2011
  14. 0/4 Document diff and filter drivers in configRamkumar Ramachandra, Apr 6, 2011
  15. 1/4 Documentation: Add filter.<driver>.* to configRamkumar Ramachandra, Apr 6, 2011
  16. Michael J GruberApr 6, 2011
  17. Ramkumar RamachandraApr 6, 2011
  18. Junio C HamanoApr 6, 2011
  19. Ramkumar RamachandraApr 6, 2011
  20. Michael J GruberApr 7, 2011
  21. Ramkumar RamachandraApr 7, 2011
  22. 2/4 Documentation: Add diff.<driver>.* to configRamkumar Ramachandra, Apr 6, 2011
  23. 3/4 Documentation: Allow custom diff tools to be specified in 'diff.tool'Ramkumar Ramachandra, Apr 6, 2011
  24. 4/4 Documentation: Minor language improvements to merge-configRamkumar Ramachandra, Apr 6, 2011
  25. 0/4 Document diff and filter drivers in configRamkumar Ramachandra, Apr 6, 2011
  26. 1/4 Documentation: Add filter.<driver>.* to configRamkumar Ramachandra, Apr 6, 2011
  27. 2/4 Documentation: Add diff.<driver>.* to configRamkumar Ramachandra, Apr 6, 2011
  28. Junio C HamanoApr 6, 2011
  29. Ramkumar RamachandraApr 7, 2011
  30. 3/4 Documentation: Allow custom diff tools to be specified in 'diff.tool'Ramkumar Ramachandra, Apr 6, 2011
  31. 4/4 Documentation: Minor language improvements to merge-configRamkumar Ramachandra, Apr 6, 2011
  32. Michael J GruberApr 7, 2011
  33. Michael J GruberApr 7, 2011

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.