diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-09-13 10:07:56 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-09-13 10:07:56 -0700 |
| commit | c52a02a0f0025df0e83ba00dc469df0dc8838b5e (patch) | |
| tree | d9f0443321dd00ead23b84b184c61476d0a15aee /builtin/describe.c | |
| parent | 94e83dcf5b5faaa22e32729305f8fd7090bfdfed (diff) | |
| parent | 0058b3d5eedcf5777712e872e01f74bf8d933be7 (diff) | |
| download | git-c52a02a0f0025df0e83ba00dc469df0dc8838b5e.tar.gz | |
Merge branch 'jk/unused-post-2.42-part2'
Unused parameters to functions are marked as such, and/or removed,
in order to bring us closer to -Wunused-parameter clean.
* jk/unused-post-2.42-part2:
parse-options: mark unused parameters in noop callback
interpret-trailers: mark unused "unset" parameters in option callbacks
parse-options: add more BUG_ON() annotations
merge: do not pass unused opt->value parameter
parse-options: mark unused "opt" parameter in callbacks
parse-options: prefer opt->value to globals in callbacks
checkout-index: delay automatic setting of to_tempfile
format-patch: use OPT_STRING_LIST for to/cc options
merge: simplify parsing of "-n" option
merge: make xopts a strvec
Diffstat (limited to 'builtin/describe.c')
| -rw-r--r-- | builtin/describe.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/describe.c b/builtin/describe.c index a9e375882b..fb6b0508f3 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -561,9 +561,11 @@ static void describe(const char *arg, int last_one) static int option_parse_exact_match(const struct option *opt, const char *arg, int unset) { + int *val = opt->value; + BUG_ON_OPT_ARG(arg); - max_candidates = unset ? DEFAULT_CANDIDATES : 0; + *val = unset ? DEFAULT_CANDIDATES : 0; return 0; } @@ -578,7 +580,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "long", &longformat, N_("always use long format")), OPT_BOOL(0, "first-parent", &first_parent, N_("only follow first parent")), OPT__ABBREV(&abbrev), - OPT_CALLBACK_F(0, "exact-match", NULL, NULL, + OPT_CALLBACK_F(0, "exact-match", &max_candidates, NULL, N_("only output exact matches"), PARSE_OPT_NOARG, option_parse_exact_match), OPT_INTEGER(0, "candidates", &max_candidates, |
