@@ -45,7 +45,8 @@ int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
err = repo_config_get_value_multi(the_repository, config_key, &values);
if (err < 0)
- return 0;
+ usage_msg_optf(_("got bad config --config=%s"),
+ for_each_repo_usage, options, config_key);
else if (err)
return 0;
@@ -541,7 +541,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
NULL
};
int ret = 1;
- const struct string_list *values;
+ const struct string_list *unused;
argc = parse_options(argc, argv, prefix, module_init_options,
git_submodule_helper_usage, 0);
@@ -553,7 +553,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get_value_multi("submodule.active", &values))
+ if (!argc && !git_config_get_value_multi("submodule.active", &unused))
module_list_active(&list);
info.prefix = prefix;
@@ -2717,7 +2717,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
if (opt.init) {
struct module_list list = MODULE_LIST_INIT;
struct init_cb info = INIT_CB_INIT;
- const struct string_list *values;
+ const struct string_list *unused;
if (module_list_compute(argv, opt.prefix,
&pathspec2, &list) < 0) {
@@ -2730,7 +2730,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get_value_multi("submodule.active", &values))
+ if (!argc && !git_config_get_value_multi("submodule.active", &unused))
module_list_active(&list);
info.prefix = opt.prefix;
@@ -33,10 +33,10 @@ test_expect_success 'do nothing on empty config' '
git for-each-repo --config=bogus.config -- help --no-such-option
'
-test_expect_success 'bad config keys' '
- git for-each-repo --config=a &&
- git for-each-repo --config=a.b. &&
- git for-each-repo --config="'\''.b"
+test_expect_success 'error on bad config keys' '
+ test_expect_code 129 git for-each-repo --config=a &&
+ test_expect_code 129 git for-each-repo --config=a.b. &&
+ test_expect_code 129 git for-each-repo --config="'\''.b"
'
test_done
As noted in 6c62f015520 (for-each-repo: do nothing on empty config, 2021-01-08) this command wants to ignore a non-existing config key, but let's not conflate that with bad config. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/for-each-repo.c | 3 ++- builtin/submodule--helper.c | 8 ++++---- t/t0068-for-each-repo.sh | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-)