Skip to content

Commit abf2952

Browse files
peffgitster
authored andcommitted
parse-options: add more BUG_ON() annotations
These callbacks are similar to the ones touched by 517fe80 (assert NOARG/NONEG behavior of parse-options callbacks, 2018-11-05), but were either missed in that commit (the one in add.c) or were added later (the one in log.c). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 62c5358 commit abf2952

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

builtin/add.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ static char *chmod_arg;
232232

233233
static int ignore_removal_cb(const struct option *opt, const char *arg, int unset)
234234
{
235+
BUG_ON_OPT_ARG(arg);
236+
235237
/* if we are told to ignore, we are not adding removals */
236238
*(int *)opt->value = !unset ? 0 : 1;
237239
return 0;

builtin/log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP;
121121
static int clear_decorations_callback(const struct option *opt UNUSED,
122122
const char *arg, int unset)
123123
{
124+
BUG_ON_OPT_NEG(unset);
125+
BUG_ON_OPT_ARG(arg);
124126
string_list_clear(&decorate_refs_include, 0);
125127
string_list_clear(&decorate_refs_exclude, 0);
126128
use_default_decoration_filter = 0;

0 commit comments

Comments
 (0)