Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 9:54 PM, Junio C Hamanowrote: > 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
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 3:08 PM, Junio C Hamanowrote: > Stefan Beller 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..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(_order_file_cfg, var, value); > > - if (!strcmp(var, "diff.ignoresubmodules")) > + if (!strcmp(var, "diff.ignoresubmodules")) { > handle_ignore_submodules_arg(_diff_options, value); > + DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG); s/options/_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
Re: diff.ignoreSubmoudles config setting broken?
Stefan Bellerwrites: > 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..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(_order_file_cfg, var, value); - if (!strcmp(var, "diff.ignoresubmodules")) + if (!strcmp(var, "diff.ignoresubmodules")) { handle_ignore_submodules_arg(_diff_options, value); + DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG); + return 0; + } if (!strcmp(var, "diff.submodule")) { if (parse_submodule_params(_diff_options, value))
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 12:54 PM, Junio C Hamanowrote: > Stefan Beller writes: > >> On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth >> 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..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
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 11:04 AM, Stefan Bellerwrote: > On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth > 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
Re: diff.ignoreSubmoudles config setting broken?
Stefan Bellerwrites: > On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberth > 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.
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 7:07 AM, Sebastian Schuberthwrote: > > + 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)
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 2:33 PM, Jeff Kingwrote: >> I'm getting >> >> $ git config --global diff.ignoreSubmodules all >> $ git diff >> diff --git a/scanners/scancode-toolkit b/scanners/scancode-toolkit >> index 65e5c9c..6b021a8 16 >> --- 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
Re: diff.ignoreSubmoudles config setting broken?
On Wed, Mar 8, 2017 at 3:01 PM, Jeff Kingwrote: >> > 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
Re: diff.ignoreSubmoudles config setting broken?
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
Re: diff.ignoreSubmoudles config setting broken?
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 16 > --- 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
diff.ignoreSubmoudles config setting broken?
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 16 --- 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