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

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-relative

which 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-relative
which 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.
Previous: kelson@shysecurity.com
Message 5 of 5 in “git-config support for diff.relative setting”
  1. git-config support for diff.relative settingkelson@shysecurity.com, Dec 20, 2014
  2. Philip OakleyDec 20, 2014
  3. Junio C HamanoDec 21, 2014
  4. kelson@shysecurity.comDec 21, 2014
  5. Junio C HamanoDec 21, 2014

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.