@@ -79,8 +79,11 @@ struct config_location_options {
79
79
int use_system_config ;
80
80
int use_local_config ;
81
81
int use_worktree_config ;
82
+ int respect_includes_opt ;
82
83
};
83
- #define CONFIG_LOCATION_OPTIONS_INIT {0}
84
+ #define CONFIG_LOCATION_OPTIONS_INIT { \
85
+ .respect_includes_opt = -1, \
86
+ }
84
87
85
88
#define CONFIG_TYPE_OPTIONS (type ) \
86
89
OPT_GROUP(N_("Type")), \
@@ -127,7 +130,6 @@ static regex_t *regexp;
127
130
static int use_key_regexp ;
128
131
static int do_all ;
129
132
static int do_not_match ;
130
- static int respect_includes_opt = -1 ;
131
133
static int fixed_value ;
132
134
133
135
#define TYPE_BOOL 1
@@ -776,10 +778,10 @@ static void location_options_init(struct config_location_options *opts,
776
778
opts -> source .scope = CONFIG_SCOPE_COMMAND ;
777
779
}
778
780
779
- if (respect_includes_opt == -1 )
781
+ if (opts -> respect_includes_opt == -1 )
780
782
opts -> options .respect_includes = !opts -> source .file ;
781
783
else
782
- opts -> options .respect_includes = respect_includes_opt ;
784
+ opts -> options .respect_includes = opts -> respect_includes_opt ;
783
785
if (startup_info -> have_repository ) {
784
786
opts -> options .commondir = get_git_common_dir ();
785
787
opts -> options .git_dir = get_git_dir ();
@@ -808,7 +810,8 @@ static int cmd_config_list(int argc, const char **argv, const char *prefix)
808
810
CONFIG_LOCATION_OPTIONS (location_opts ),
809
811
CONFIG_DISPLAY_OPTIONS (display_opts ),
810
812
OPT_GROUP (N_ ("Other" )),
811
- OPT_BOOL (0 , "includes" , & respect_includes_opt , N_ ("respect include directives on lookup" )),
813
+ OPT_BOOL (0 , "includes" , & location_opts .respect_includes_opt ,
814
+ N_ ("respect include directives on lookup" )),
812
815
OPT_END (),
813
816
};
814
817
@@ -850,7 +853,8 @@ static int cmd_config_get(int argc, const char **argv, const char *prefix)
850
853
OPT_STRING (0 , "url" , & url , N_ ("URL" ), N_ ("show config matching the given URL" )),
851
854
CONFIG_DISPLAY_OPTIONS (display_opts ),
852
855
OPT_GROUP (N_ ("Other" )),
853
- OPT_BOOL (0 , "includes" , & respect_includes_opt , N_ ("respect include directives on lookup" )),
856
+ OPT_BOOL (0 , "includes" , & location_opts .respect_includes_opt ,
857
+ N_ ("respect include directives on lookup" )),
854
858
OPT_STRING (0 , "default" , & display_opts .default_value ,
855
859
N_ ("value" ), N_ ("use default value when missing entry" )),
856
860
OPT_END (),
@@ -1133,7 +1137,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
1133
1137
N_ ("value" ), N_ ("with --get, use default value when missing entry" )),
1134
1138
OPT_STRING (0 , "comment" , & comment_arg , N_ ("value" ), N_ ("human-readable comment string (# will be prepended as needed)" )),
1135
1139
OPT_BOOL (0 , "fixed-value" , & fixed_value , N_ ("use string equality when comparing values to 'value-pattern'" )),
1136
- OPT_BOOL (0 , "includes" , & respect_includes_opt , N_ ("respect include directives on lookup" )),
1140
+ OPT_BOOL (0 , "includes" , & location_opts .respect_includes_opt ,
1141
+ N_ ("respect include directives on lookup" )),
1137
1142
OPT_END (),
1138
1143
};
1139
1144
char * value = NULL , * comment = NULL ;
0 commit comments