Web lists-archives.com

Re: diff.ignoreSubmoudles config setting broken?




Stefan Beller <sbeller@xxxxxxxxxx> 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))