All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>, git@vger.kernel.org
Subject: Re: [RFC/PATCH] attr: map builtin userdiff drivers to well-known extensions
Date: Thu, 25 Aug 2011 22:59:13 -0400	[thread overview]
Message-ID: <20110826025913.GC17625@sigill.intra.peff.net> (raw)
In-Reply-To: <7v8vqhhzgd.fsf@alter.siamese.dyndns.org>

On Thu, Aug 25, 2011 at 03:57:06PM -0700, Junio C Hamano wrote:

> > If you have any matching attribute line in your own files, it should
> > override. So:
> >
> >   foo/* -diff
> >
> > will still mark foo/bar.c as binary, even with this change.
> >
> > Can anyone think of other possible side effects?
> >
> > Also, any other extensions that would go into such a list? I have no
> > idea what the common extension is for something like pascal or csharp.
> 
> As long as the builtin ones are the lowest priority fallback, we should be
> Ok.
> 
> Do we say anywhere that "Ah, this has 'diff' attribute defined, so it must
> be text"? If so, we should fix _that_. In other words, having this one
> extra entry
> 
> 	"* diff=default"
> 
> in the builtin_attr[] array should be a no-op, I think.

No, certainly not since 122aa6f (diff: introduce diff.<driver>.binary,
2008-10-05). That commit's message claims that we did before it, but
looking at the patch, I am not so sure. But I'm not about to start
testing a 3-year-old patch to see if it really was the source of the
fix; the point is that it is correct now. :)

I think it could be a problem in the future if the builtin userdiff
drivers started growing more invasive options, like automatically
claiming to be non-binary (i.e., setting diff.cpp.binary = false by
default). In other words, I think we have two options:

  1. Builtin drivers like "cpp" can stay minimal, only setting funcname
     and color-words headers that aren't going to produce terrible
     results if we are wrong about detecting by extension.

  2. We force the user to identify file types manually, so we can't be
     wrong. The "cpp" diff driver means "you are a text C file", and if
     a user mis-marks a binary file with that diff driver, they are the
     one who is wrong.

So if it's an either/or situation, we should decide not only that
extension auto-detection is a good feature, but that it trumps adding
more advanced features to the builtin drivers in the future.

Or we could decide that the extensions really are good enough, and if
you really do have binary files named "foo.c", it's your problem to
override the defaults with "*.c -diff".

-Peff

  reply	other threads:[~2011-08-26  2:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 19:14 git diff annoyance / feature request Boaz Harrosh
2011-08-25 20:00 ` Jeff King
2011-08-25 20:40   ` [RFC/PATCH] attr: map builtin userdiff drivers to well-known extensions Jeff King
2011-08-25 21:00     ` Eric Sunshine
2011-08-25 21:06       ` Jeff King
2011-08-25 22:01         ` Boaz Harrosh
2011-08-25 23:44         ` Eric Sunshine
2011-08-26  2:39           ` Jeff King
2011-08-25 22:29     ` Brandon Casey
2011-08-26  2:45       ` Jeff King
2011-08-26  3:58         ` Eric Sunshine
2011-08-26 15:33         ` Brandon Casey
2011-08-25 22:57     ` Junio C Hamano
2011-08-26  2:59       ` Jeff King [this message]
2011-08-26  5:52         ` Junio C Hamano
2011-08-26  9:44     ` Thomas Rast
2011-08-27  5:14     ` Alexey Shumkin
2011-08-25 20:27 ` git diff annoyance / feature request Junio C Hamano
2011-08-25 21:58   ` Boaz Harrosh
2011-08-26  9:08     ` Miles Bader
2011-08-26 21:16 ` René Scharfe
2011-08-26 21:37   ` Boaz Harrosh
2011-08-26 21:52     ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20110826025913.GC17625@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bharrosh@panasas.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.