@@ -2148,17 +2148,22 @@ static int check_name(int argc, const char **argv, const char *prefix)
2148
2148
static int module_config (int argc , const char * * argv , const char * prefix )
2149
2149
{
2150
2150
enum {
2151
- CHECK_WRITEABLE = 1
2151
+ CHECK_WRITEABLE = 1 ,
2152
+ DO_UNSET = 2
2152
2153
} command = 0 ;
2153
2154
2154
2155
struct option module_config_options [] = {
2155
2156
OPT_CMDMODE (0 , "check-writeable" , & command ,
2156
2157
N_ ("check if it is safe to write to the .gitmodules file" ),
2157
2158
CHECK_WRITEABLE ),
2159
+ OPT_CMDMODE (0 , "unset" , & command ,
2160
+ N_ ("unset the config in the .gitmodules file" ),
2161
+ DO_UNSET ),
2158
2162
OPT_END ()
2159
2163
};
2160
2164
const char * const git_submodule_helper_usage [] = {
2161
- N_ ("git submodule--helper config name [value]" ),
2165
+ N_ ("git submodule--helper config <name> [<value>]" ),
2166
+ N_ ("git submodule--helper config --unset <name>" ),
2162
2167
N_ ("git submodule--helper config --check-writeable" ),
2163
2168
NULL
2164
2169
};
@@ -2170,15 +2175,17 @@ static int module_config(int argc, const char **argv, const char *prefix)
2170
2175
return is_writing_gitmodules_ok () ? 0 : -1 ;
2171
2176
2172
2177
/* Equivalent to ACTION_GET in builtin/config.c */
2173
- if (argc == 2 )
2178
+ if (argc == 2 && command != DO_UNSET )
2174
2179
return print_config_from_gitmodules (the_repository , argv [1 ]);
2175
2180
2176
2181
/* Equivalent to ACTION_SET in builtin/config.c */
2177
- if (argc == 3 ) {
2182
+ if (argc == 3 || (argc == 2 && command == DO_UNSET )) {
2183
+ const char * value = (argc == 3 ) ? argv [2 ] : NULL ;
2184
+
2178
2185
if (!is_writing_gitmodules_ok ())
2179
2186
die (_ ("please make sure that the .gitmodules file is in the working tree" ));
2180
2187
2181
- return config_set_in_gitmodules_file_gently (argv [1 ], argv [ 2 ] );
2188
+ return config_set_in_gitmodules_file_gently (argv [1 ], value );
2182
2189
}
2183
2190
2184
2191
usage_with_options (git_submodule_helper_usage , module_config_options );
0 commit comments