Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > From: Johannes Schindelin <johannes.schindelin@xxxxxx> > Date: Thu, 5 Aug 2010 10:49:55 +0200 > Subject: [PATCH] Add the 'diff.ignoreSubmodules' config setting > ... > This commit introduces a global config setting to set a default > (porcelain) value for the --ignore-submodules option, keeping the > default at 'none'. It can be overridden by the submodule.*.ignore > setting and by the --ignore-submodules option. > ... > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> > --- Nice, at least from a cursory look. diff_setup() is shared by everybody both plumbing and Porcelain that use diff and log, but you placed the smudging of the default based on config is in diff_ui_config(), so this patch looks safe. And the default setting can be overriden with --ignore-submodules from the command line during diff_opt_parse(), which is also safe and sane. Thanks; will queue. > diff --git a/diff.c b/diff.c > index 8206047..1ddfdfb 100644 > --- a/diff.c > +++ b/diff.c > @@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg; > int diff_auto_refresh_index = 1; > static int diff_mnemonic_prefix; > static int diff_no_prefix; > +static struct diff_options default_diff_options; > > static char diff_colors[][COLOR_MAXLEN] = { > GIT_COLOR_RESET, > @@ -107,6 +108,9 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) > if (!strcmp(var, "diff.wordregex")) > return git_config_string(&diff_word_regex_cfg, var, value); > > + if (!strcmp(var, "diff.ignoresubmodules")) > + handle_ignore_submodules_arg(&default_diff_options, value); > + > return git_diff_basic_config(var, value, cb); > } > > @@ -2816,7 +2820,7 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o) > > void diff_setup(struct diff_options *options) > { > - memset(options, 0, sizeof(*options)); > + memcpy(options, &default_diff_options, sizeof(*options)); > memset(&diff_queued_diff, 0, sizeof(diff_queued_diff)); > > options->file = stdout; > diff --git a/submodule.c b/submodule.c > index 1bcb0e9..75f3368 100644 > --- a/submodule.c > +++ b/submodule.c > @@ -110,6 +110,10 @@ int parse_submodule_config_option(const char *var, const char *value) > void handle_ignore_submodules_arg(struct diff_options *diffopt, > const char *arg) > { > + DIFF_OPT_CLR(diffopt, IGNORE_SUBMODULES); > + DIFF_OPT_CLR(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES); > + DIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES); > + > if (!strcmp(arg, "all")) > DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES); > else if (!strcmp(arg, "untracked")) > -- > 1.7.2.1.2240.gde5dd > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html