All of lore.kernel.org
 help / color / mirror / Atom feed
* diff.ignoreSubmoudles config setting broken?
@ 2017-03-08 12:54 Sebastian Schuberth
  2017-03-08 13:33 ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Schuberth @ 2017-03-08 12:54 UTC (permalink / raw)
  To: git; +Cc: Stefan Beller

Hi,

with

$ git --version
git version 2.12.0.windows.1

I'm getting

$ git config --global diff.ignoreSubmodules all
$ git diff
diff --git a/scanners/scancode-toolkit b/scanners/scancode-toolkit
index 65e5c9c..6b021a8 160000
--- a/scanners/scancode-toolkit
+++ b/scanners/scancode-toolkit
@@ -1 +1 @@
-Subproject commit 65e5c9c9508441c5f62beff4749cf455c6eadc30
+Subproject commit 6b021a8addf6d3c5f2a6ef1af6245e095c21d8ec

but with

$ git diff --ignore-submodules=all

I'm getting the expected empty output.

I can reproduce the same on Linux with "git version 2.11.0". Am I missing something, or is this a bug?

Regards,
Sebastian


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 12:54 diff.ignoreSubmoudles config setting broken? Sebastian Schuberth
@ 2017-03-08 13:33 ` Jeff King
  2017-03-08 13:43   ` Sebastian Schuberth
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-03-08 13:33 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git, Stefan Beller

On Wed, Mar 08, 2017 at 01:54:02PM +0100, Sebastian Schuberth wrote:

> I'm getting
> 
> $ git config --global diff.ignoreSubmodules all
> $ git diff
> diff --git a/scanners/scancode-toolkit b/scanners/scancode-toolkit
> index 65e5c9c..6b021a8 160000
> --- a/scanners/scancode-toolkit
> +++ b/scanners/scancode-toolkit
> @@ -1 +1 @@
> -Subproject commit 65e5c9c9508441c5f62beff4749cf455c6eadc30
> +Subproject commit 6b021a8addf6d3c5f2a6ef1af6245e095c21d8ec
>
> but with
> 
> $ git diff --ignore-submodules=all

Hrm. Isn't "all" the default? That's what git-diff(1) says (but I've
never used the feature myself).

That would imply to me that there's another config option set somewhere
(perhaps in the repo-level config). What does:

  git config --show-origin --get-all diff.ignoresubmodules

say?

-Peff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 13:33 ` Jeff King
@ 2017-03-08 13:43   ` Sebastian Schuberth
  2017-03-08 14:01     ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Schuberth @ 2017-03-08 13:43 UTC (permalink / raw)
  To: Jeff King; +Cc: Git Mailing List, Stefan Beller

On Wed, Mar 8, 2017 at 2:33 PM, Jeff King <peff@peff.net> wrote:

>> I'm getting
>>
>> $ git config --global diff.ignoreSubmodules all
>> $ git diff
>> diff --git a/scanners/scancode-toolkit b/scanners/scancode-toolkit
>> index 65e5c9c..6b021a8 160000
>> --- a/scanners/scancode-toolkit
>> +++ b/scanners/scancode-toolkit
>> @@ -1 +1 @@
>> -Subproject commit 65e5c9c9508441c5f62beff4749cf455c6eadc30
>> +Subproject commit 6b021a8addf6d3c5f2a6ef1af6245e095c21d8ec
>>
>> but with
>>
>> $ git diff --ignore-submodules=all
>
> Hrm. Isn't "all" the default? That's what git-diff(1) says (but I've
> never used the feature myself).
>
> That would imply to me that there's another config option set somewhere
> (perhaps in the repo-level config). What does:
>
>   git config --show-origin --get-all diff.ignoresubmodules
>
> say?

It says:

file:/home/seschube/.gitconfig  all

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 13:43   ` Sebastian Schuberth
@ 2017-03-08 14:01     ` Jeff King
  2017-03-08 15:07       ` Sebastian Schuberth
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-03-08 14:01 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: Git Mailing List, Stefan Beller

On Wed, Mar 08, 2017 at 02:43:00PM +0100, Sebastian Schuberth wrote:

> > Hrm. Isn't "all" the default? That's what git-diff(1) says (but I've
> > never used the feature myself).
> >
> > That would imply to me that there's another config option set somewhere
> > (perhaps in the repo-level config). What does:
> >
> >   git config --show-origin --get-all diff.ignoresubmodules
> >
> > say?
> 
> It says:
> 
> file:/home/seschube/.gitconfig  all

OK, that looks right, so my guess is probably the wrong direction.
Peeking at the code, it looks like there may be some per-submodule
magic, but I don't know how it all works. So I'll stop looking and wait
for somebody more clueful to respond.

-Peff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 14:01     ` Jeff King
@ 2017-03-08 15:07       ` Sebastian Schuberth
  2017-03-08 19:04         ` Stefan Beller
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Schuberth @ 2017-03-08 15:07 UTC (permalink / raw)
  To: Jeff King; +Cc: Git Mailing List, Stefan Beller, Jens.Lehmann

On Wed, Mar 8, 2017 at 3:01 PM, Jeff King <peff@peff.net> wrote:

>> > Hrm. Isn't "all" the default? That's what git-diff(1) says (but I've
>> > never used the feature myself).
>> >
>> > That would imply to me that there's another config option set somewhere
>> > (perhaps in the repo-level config). What does:
>> >
>> >   git config --show-origin --get-all diff.ignoresubmodules
>> >
>> > say?
>>
>> It says:
>>
>> file:/home/seschube/.gitconfig  all
>
> OK, that looks right, so my guess is probably the wrong direction.
> Peeking at the code, it looks like there may be some per-submodule
> magic, but I don't know how it all works. So I'll stop looking and wait
> for somebody more clueful to respond.

+ Jens

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 15:07       ` Sebastian Schuberth
@ 2017-03-08 19:04         ` Stefan Beller
  2017-03-08 20:54           ` Junio C Hamano
  2017-03-08 22:27           ` Jacob Keller
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Beller @ 2017-03-08 19:04 UTC (permalink / raw)
  To: Sebastian Schuberth, Jacob Keller
  Cc: Jeff King, Git Mailing List, Jens Lehmann

On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth
<sschuberth@gmail.com> 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)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 19:04         ` Stefan Beller
@ 2017-03-08 20:54           ` Junio C Hamano
  2017-03-08 22:11             ` Stefan Beller
  2017-03-09 16:15             ` Sebastian Schuberth
  2017-03-08 22:27           ` Jacob Keller
  1 sibling, 2 replies; 12+ messages in thread
From: Junio C Hamano @ 2017-03-08 20:54 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Sebastian Schuberth, Jacob Keller, Jeff King, Git Mailing List,
	Jens Lehmann

Stefan Beller <sbeller@google.com> writes:

> On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth
> <sschuberth@gmail.com> 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.

This comes from aee9c7d6 ("Submodules: Add the new "ignore" config
option for diff and status", 2010-08-06), which is ancient and
predates even v2.0, so if you see problems with v2.12 or v2.11 but
not with older ones, that would rule out this theory.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 20:54           ` Junio C Hamano
@ 2017-03-08 22:11             ` Stefan Beller
  2017-03-08 23:08               ` Junio C Hamano
  2017-03-09 16:15             ` Sebastian Schuberth
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Beller @ 2017-03-08 22:11 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Sebastian Schuberth, Jacob Keller, Jeff King, Git Mailing List,
	Jens Lehmann

On Wed, Mar 8, 2017 at 12:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth
>> <sschuberth@gmail.com> 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,
e.g.

  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.

Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 19:04         ` Stefan Beller
  2017-03-08 20:54           ` Junio C Hamano
@ 2017-03-08 22:27           ` Jacob Keller
  1 sibling, 0 replies; 12+ messages in thread
From: Jacob Keller @ 2017-03-08 22:27 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Sebastian Schuberth, Jeff King, Git Mailing List, Jens Lehmann

On Wed, Mar 8, 2017 at 11:04 AM, Stefan Beller <sbeller@google.com> wrote:
> On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth
> <sschuberth@gmail.com> 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)

I don't remember doing anything with ignoreSubmodules, but it's
possible I broke it...

-Jake

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 22:11             ` Stefan Beller
@ 2017-03-08 23:08               ` Junio C Hamano
  2017-03-09  1:30                 ` Stefan Beller
  0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-03-08 23:08 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Sebastian Schuberth, Jacob Keller, Jeff King, Git Mailing List,
	Jens Lehmann

Stefan Beller <sbeller@google.com> writes:

> 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

I've never understood why people thought it a good idea to let
.gitmodules supplied by the upstream override the configuration
setting the end user has like this.  This is quite bad.

Perhaps this is a good starting point?

 diff.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/diff.c b/diff.c
index a628ac3a95..75b7140c63 100644
--- a/diff.c
+++ b/diff.c
@@ -273,8 +273,11 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
 	if (!strcmp(var, "diff.orderfile"))
 		return git_config_pathname(&diff_order_file_cfg, var, value);
 
-	if (!strcmp(var, "diff.ignoresubmodules"))
+	if (!strcmp(var, "diff.ignoresubmodules")) {
 		handle_ignore_submodules_arg(&default_diff_options, value);
+		DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
+		return 0;
+	}
 
 	if (!strcmp(var, "diff.submodule")) {
 		if (parse_submodule_params(&default_diff_options, value))

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 23:08               ` Junio C Hamano
@ 2017-03-09  1:30                 ` Stefan Beller
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Beller @ 2017-03-09  1:30 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Sebastian Schuberth, Jacob Keller, Jeff King, Git Mailing List,
	Jens Lehmann

On Wed, Mar 8, 2017 at 3:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> Yeah the .gitmodules file is a good hint.

And by that I meant that I am not sure if we're going
down the right rabbit hole here. So before we take action
maybe Sebastian can tell us more about his project (and all
configurations and settings involved)

>>
>> 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
>
> I've never understood why people thought it a good idea to let
> .gitmodules supplied by the upstream override the configuration
> setting the end user has like this.  This is quite bad.

Apart from from the name <-> path mapping, the .gitmodules
file is a collection of suggestions, some more severe than
others.

I think the issue here is to define the correct
and clear order of precedence, specifically between along these
2 different dimensions (different configuration settings vs different
files with configuration), such that the .gitmodules file is only ever
consulted when the user has obviously nothing configured that
would contradict the .gitmodules file.

>
> Perhaps this is a good starting point?
>
>  diff.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/diff.c b/diff.c
> index a628ac3a95..75b7140c63 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -273,8 +273,11 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
>         if (!strcmp(var, "diff.orderfile"))
>                 return git_config_pathname(&diff_order_file_cfg, var, value);
>
> -       if (!strcmp(var, "diff.ignoresubmodules"))
> +       if (!strcmp(var, "diff.ignoresubmodules")) {
>                 handle_ignore_submodules_arg(&default_diff_options, value);
> +               DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);

s/options/&default_diff_options/ makes it compile. (I did not think
whether that is
correct though.)

In other occurrences of handle_ignore_submodules_arg, the DIFF_OPT_SET
is set before the handle_ignore_submodules_arg, though.

When trying these suggestions, ./t4027-diff-submodule.sh breaks.
log on that file yields e.g. 302ad7a9930 (Submodules: Use "ignore" settings
from .gitmodules too for diff and status), which tells us that in 2010 people
were not as concerned by this, but the user had to use the exact option to
override the upstream default-suggestion.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: diff.ignoreSubmoudles config setting broken?
  2017-03-08 20:54           ` Junio C Hamano
  2017-03-08 22:11             ` Stefan Beller
@ 2017-03-09 16:15             ` Sebastian Schuberth
  1 sibling, 0 replies; 12+ messages in thread
From: Sebastian Schuberth @ 2017-03-09 16:15 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stefan Beller, Jacob Keller, Jeff King, Git Mailing List, Jens Lehmann

On Wed, Mar 8, 2017 at 9:54 PM, Junio C Hamano <gitster@pobox.com> wrote:

> 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.
>
> This comes from aee9c7d6 ("Submodules: Add the new "ignore" config
> option for diff and status", 2010-08-06), which is ancient and
> predates even v2.0, so if you see problems with v2.12 or v2.11 but
> not with older ones, that would rule out this theory.

Thanks for reminding me of possible settings .gitmodules. Indeed I have

[submodule "scanners/scancode-toolkit"]
        path = scanners/scancode-toolkit
        url = https://github.com/sschuberth/scancode-toolkit.git
        ignore = untracked

in .gitmodules, which explains why globally setting
"diff.ignoreSubmodules" to "all" had no effect.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-03-09 16:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 12:54 diff.ignoreSubmoudles config setting broken? Sebastian Schuberth
2017-03-08 13:33 ` Jeff King
2017-03-08 13:43   ` Sebastian Schuberth
2017-03-08 14:01     ` Jeff King
2017-03-08 15:07       ` Sebastian Schuberth
2017-03-08 19:04         ` Stefan Beller
2017-03-08 20:54           ` Junio C Hamano
2017-03-08 22:11             ` Stefan Beller
2017-03-08 23:08               ` Junio C Hamano
2017-03-09  1:30                 ` Stefan Beller
2017-03-09 16:15             ` Sebastian Schuberth
2017-03-08 22:27           ` Jacob Keller

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.