git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
	Git List <git@vger.kernel.org>, Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH 2/3] Documentation: Add diff.<driver>.* to config
Date: Mon, 04 Apr 2011 10:24:38 -0700	[thread overview]
Message-ID: <7v1v1i9bft.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4D998736.2080901@drmicha.warpmail.net> (Michael J. Gruber's message of "Mon, 04 Apr 2011 10:54:14 +0200")

Michael J Gruber <git@drmicha.warpmail.net> writes:

>> ...
>> +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.

>> +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".

>> +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.

>> +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.

  reply	other threads:[~2011-04-04 17:25 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  8:47 [PATCH] Documentation: Document diff.<tool>.* and filter.<driver>.* in config Ramkumar Ramachandra
2011-04-01  9:18 ` Jakub Narebski
2011-04-01 10:43   ` [PATCH v2] " Ramkumar Ramachandra
2011-04-01 13:50     ` Jakub Narebski
2011-04-01 13:56     ` Michael J Gruber
2011-04-03 14:25     ` [PATCH v3 0/3] Document diff and filter drivers " Ramkumar Ramachandra
2011-04-03 14:25       ` [PATCH 1/3] Documentation: Add filter.<driver>.* to config Ramkumar Ramachandra
2011-04-04  8:46         ` Michael J Gruber
2011-04-03 14:25       ` [PATCH 2/3] Documentation: Add diff.<driver>.* " Ramkumar Ramachandra
2011-04-04  8:54         ` Michael J Gruber
2011-04-04 17:24           ` Junio C Hamano [this message]
2011-04-03 14:25       ` [PATCH 3/3] Documentation: Allow custom diff tools to be specified in 'diff.tool' Ramkumar Ramachandra
2011-04-04  8:55         ` Michael J Gruber
2011-04-06  9:57     ` [PATCH v4 0/4] Document diff and filter drivers in config Ramkumar Ramachandra
2011-04-06  9:57       ` [PATCH 1/4] Documentation: Add filter.<driver>.* to config Ramkumar Ramachandra
2011-04-06 11:27         ` Michael J Gruber
2011-04-06 12:51           ` Ramkumar Ramachandra
2011-04-06 16:50             ` Junio C Hamano
2011-04-06 18:09               ` Ramkumar Ramachandra
2011-04-07 11:57                 ` Michael J Gruber
2011-04-07 16:19                   ` Ramkumar Ramachandra
2011-04-06  9:57       ` [PATCH 2/4] Documentation: Add diff.<driver>.* " Ramkumar Ramachandra
2011-04-06  9:57       ` [PATCH 3/4] Documentation: Allow custom diff tools to be specified in 'diff.tool' Ramkumar Ramachandra
2011-04-06  9:57       ` [PATCH 4/4] Documentation: Minor language improvements to merge-config Ramkumar Ramachandra
2011-04-06 18:46       ` [PATCH v5 0/4] Document diff and filter drivers in config Ramkumar Ramachandra
2011-04-06 18:46         ` [PATCH 1/4] Documentation: Add filter.<driver>.* to config Ramkumar Ramachandra
2011-04-06 18:46         ` [PATCH 2/4] Documentation: Add diff.<driver>.* " Ramkumar Ramachandra
2011-04-06 19:48           ` Junio C Hamano
2011-04-07  3:03             ` Ramkumar Ramachandra
2011-04-06 18:46         ` [PATCH 3/4] Documentation: Allow custom diff tools to be specified in 'diff.tool' Ramkumar Ramachandra
2011-04-06 18:46         ` [PATCH 4/4] Documentation: Minor language improvements to merge-config Ramkumar Ramachandra
2011-04-07 12:47       ` [PATCH v4 0/4] Document diff and filter drivers in config Michael J Gruber
2011-04-07 12:48         ` Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v1v1i9bft.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).