Re: [PATCH v1 0/3] Introduce config variable "diff.primer"
- From
Keith Cascio <keith@cs.ucla.edu>
- Date
- Jan 27, 2009, 01:47 UTC
- Message-ID
- <alpine.GSO.2.00.0901261734360.16158@kiwi.cs.ucla.edu>
- In-Reply-To
- <20090125220756.GA18855@coredump.intra.peff.net>
On Sun, 25 Jan 2009, Jeff King wrote:
Show 17 quoted lines
> let's say I have a gitattributes file like this: > *.c diff=c > and my config says: > [diff] > opt1 = val1_default > opt2 = val2_default > [diff "c"] > opt1 = val1_c > > Now obviously if I want to use opt1 for my C files, it should be val1_c. > But if I want to use opt2, what should it use? There are two reasonable > choices, I think: > 1. You use val2_default. The rationale is that the "c" diff driver did > not define an opt2, so you fall back to the global default. > 2. It is unset. The rationale is that you are using the "c" diff > driver, and it has left the value unset. The default then means "if > you have no diff driver setup".
I'm in favor of option (2), because [diff] a.k.a [diff ""] serving as the fallback for [diff *] feels like a special case. If a full system of precedence and fallbacks is desired for .git/config, we should adopt explicit grammar that lets me define an arbitrary precedence tree over all sections. Once a powerful concept is born, somewhere down the road, some user will desire its universalization.