Re: [PATCH v2] git-config support for diff.relative setting
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 21, 2014, 22:46 UTC
- Message-ID
- <xmqqppbcbozr.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <54972281.9050603@shysecurity.com>
kelson@shysecurity.com writes:
Show 18 quoted lines
>> "Philip Oakley" <philipoakley@iee.org> wrote: >> Shouldn't this `(identical to "git diff --relative")` also be >>included in the documentation change? It would truly clarify the >> intenbt for the reader. > > Updated as follows: > +diff.relative:: > + Show pathnames relative to the current directory and exclude > + changes outside this directory; equivalent to the 'git diff' > + option '--relative'. > >> "Junio C Hamano" <gitster@pobox.com> wrote: >> There should be a way to run non-relative diff in a repository that >> has the configuration set, perhaps by overriding with some command >> line option (e.g. "--no-relative"). > > Good idea; I'll put together a second patch for a "--no-relative" > option to disable diff.relative.
The order should be first to add --no-relative, which should allow you to say
$ alias gd "git diff --relative"
$ gd --no-relativewhich would expand to "git diff --relative --no-relative" to defeat the earlier one on the command line, and then add diff.relative in the second patch, I would think. A natural consequence of the latter would be that these would steps work as expected:
$ git config diff.relative no
$ git diff
$ git diff --relative
$ git diff --no-relative
$ git config diff.relative yes
$ git diff
$ git diff --relative
$ git diff --no-relativewhich should be tested in a new set of tests added to t4045.
For the first patch, I would expect a new set of tests added to t4045 to check at least the following:
$ git diff --no-relative $ git diff --no-relative --relative $ git diff --relative --no-relative
Thanks.