@@ -1095,7 +1095,6 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "diff.ignoresubmodules")) {
struct checkout_opts *opts = cb;
- diff_ignore_submodule_config =1;
handle_ignore_submodules_arg(&opts->diff_options, value);
return 0;
}
@@ -51,7 +51,6 @@ static int diff_no_prefix;
static int diff_relative;
static int diff_stat_graph_width;
static int diff_dirstat_permille_default = 30;
-int diff_ignore_submodule_config = 0;
static struct diff_options default_diff_options;
static long diff_algorithm;
static unsigned ws_error_highlight_default = WSEH_NEW;
@@ -403,10 +402,8 @@ 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")) {
- diff_ignore_submodule_config =1;
+ if (!strcmp(var, "diff.ignoresubmodules"))
handle_ignore_submodules_arg(&default_diff_options, value);
- }
if (!strcmp(var, "diff.submodule")) {
if (parse_submodule_params(&default_diff_options, value))
@@ -4598,8 +4595,10 @@ void repo_diff_setup(struct repository *r, struct diff_options *options)
options->color_moved = diff_color_moved_default;
options->color_moved_ws_handling = diff_color_moved_ws_default;
- if(!diff_ignore_submodule_config)
- handle_ignore_submodules_arg(options, "untracked");
+
+ if(!options->flags.ignore_submodule_set)
+ options->flags.ignore_untracked_in_submodules = 1;
+
prep_parse_options(options);
}
@@ -5142,7 +5141,6 @@ static int diff_opt_ignore_submodules(const struct option *opt,
if (!arg)
arg = "all";
options->flags.override_submodule_config = 1;
- diff_ignore_submodule_config =1;
handle_ignore_submodules_arg(options, arg);
return 0;
}
@@ -180,6 +180,7 @@ struct diff_flags {
unsigned ignore_untracked_in_submodules;
unsigned ignore_dirty_submodules;
unsigned override_submodule_config;
+ unsigned ignore_submodule_set;
unsigned dirstat_by_line;
unsigned funccontext;
unsigned default_follow_renames;
@@ -556,12 +557,6 @@ int diff_queue_is_empty(void);
void diff_flush(struct diff_options*);
void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);
-/*
- * This is for keeping a track whether ignoreSubmodules
- * is present in user defined config or not.
- */
-extern int diff_ignore_submodule_config;
-
/* diff-raw status letters */
#define DIFF_STATUS_ADDED 'A'
#define DIFF_STATUS_COPIED 'C'
@@ -198,10 +198,8 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
ignore = submodule->ignore;
free(key);
- if (ignore){
- diff_ignore_submodule_config =1;
+ if (ignore)
handle_ignore_submodules_arg(diffopt, ignore);
- }
else if (is_gitmodules_unmerged(the_repository->index))
diffopt->flags.ignore_submodules = 1;
}
@@ -422,6 +420,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
void handle_ignore_submodules_arg(struct diff_options *diffopt,
const char *arg)
{
+ diffopt->flags.ignore_submodule_set = 1;
diffopt->flags.ignore_submodules = 0;
diffopt->flags.ignore_untracked_in_submodules = 0;
diffopt->flags.ignore_dirty_submodules = 0;
@@ -605,7 +605,6 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
rev.diffopt.flags.ignore_untracked_in_submodules = 1;
if (s->ignore_submodule_arg) {
rev.diffopt.flags.override_submodule_config = 1;
- diff_ignore_submodule_config =1;
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
}
rev.diffopt.format_callback = wt_status_collect_changed_cb;
@@ -630,7 +629,6 @@ static void wt_status_collect_changes_index(struct wt_status *s)
rev.diffopt.flags.override_submodule_config = 1;
rev.diffopt.ita_invisible_in_index = 1;
if (s->ignore_submodule_arg) {
- diff_ignore_submodule_config =1;
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
} else {
/*
@@ -641,7 +639,6 @@ static void wt_status_collect_changes_index(struct wt_status *s)
* shown any submodules she manually added (and which are
* staged to be committed), which would be really confusing.
*/
- diff_ignore_submodule_config =1;
handle_ignore_submodules_arg(&rev.diffopt, "dirty");
}