Skip to content

Commit 13d9fce

Browse files
avargitster
authored andcommitted
commit-graph: stop using optname()
Stop using optname() in builtin/commit-graph.c to emit an error with the --max-new-filters option. This changes code added in 809e032 (builtin/commit-graph.c: introduce '--max-new-filters=<n>', 2020-09-18). See 9440b83 (parse-options: replace opterror() with optname(), 2018-11-10) for why using optname() like this is considered bad, i.e. it's assembling human-readable output piecemeal, and the "option `X'" at the start can't be translated. It didn't matter in this case, but this code was also buggy in its use of "opt->flags" to optname(), that function expects flags, but not *those* flags. Let's pass "max-new-filters" to the new error because the option name isn't translatable, and because we can re-use a translation added in f7e68a0 (parse-options: check empty value in OPT_INTEGER and OPT_ABBREV, 2019-05-29). Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c2047a commit 13d9fce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/commit-graph.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static int write_option_max_new_filters(const struct option *opt,
172172
const char *s;
173173
*to = strtol(arg, (char **)&s, 10);
174174
if (*s)
175-
return error(_("%s expects a numerical value"),
176-
optname(opt, opt->flags));
175+
return error(_("option `%s' expects a numerical value"),
176+
"max-new-filters");
177177
}
178178
return 0;
179179
}

0 commit comments

Comments
 (0)