Web lists-archives.com

Re: diff.ignoreSubmoudles config setting broken?

On Wed, Mar 8, 2017 at 12:54 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Stefan Beller <sbeller@xxxxxxxxxx> writes:
>> On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth
>> <sschuberth@xxxxxxxxx> wrote:
>>> + Jens
>> + Jacob Keller, who touched submodule diff display code last.
>> (I am thinking of fd47ae6a, diff: teach diff to display submodule
>> difference with an inline diff, 2016-08-31), which is first release as
>> part of v2.11.0 (that would fit your observance)
> Between these two:
>         git -c diff.ignoresubmodules=all diff
>         git diff --ignore-submodules=all
> one difference is that the latter disables reading extra config from
> .gitmodules (!) while the former makes the command honor it.

Yeah the .gitmodules file is a good hint.

Here is my understanding of the precedence:

  command line options > .git/config (in various forms) > .gitmodules

where in the .git config we have precedence levels for different files

  .git/config > ~/.gitconfig

as well as different settings:

  submodule.<name>.ignore > diff.ignoreSubmodules

It is not clear to me how a specific setting in .gitmodules
would interact with a submodule-global setting in the config,

  git config -f .gitmodules submodule. \
      "$(git submodule--helper name scanners/scancode-toolkit)". \
      ignore none
  git config diff.ignoreSubmodules all
  git diff  scanners/scancode-toolkit

>From reading the code, I assume "diff.ignoreSubmodules all"
takes precedence here nevertheless because the diff.ignoreSubmodules
setting is treated on a higher level than the submodule specific setting,
despite the submodule specific setting being more specific.

This is a bad example, because it may be intuitive that the
value in the .git/config file takes precedence over .gitmodules,
but we cannot set diff.ignoreSubmodules in .gitmodules.