]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-options: add more BUG_ON() annotations
authorJeff King <peff@peff.net>
Thu, 31 Aug 2023 21:21:49 +0000 (17:21 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Sep 2023 21:48:17 +0000 (14:48 -0700)
These callbacks are similar to the ones touched by 517fe807d6 (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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/add.c
builtin/log.c

index 4b0dd798df5909905f7be69479d4b3b2ce1b19ae..cf59108523b8fdf765aa0757cb6a204cd8fe52b9 100644 (file)
@@ -232,6 +232,8 @@ static char *chmod_arg;
 
 static int ignore_removal_cb(const struct option *opt, const char *arg, int unset)
 {
+       BUG_ON_OPT_ARG(arg);
+
        /* if we are told to ignore, we are not adding removals */
        *(int *)opt->value = !unset ? 0 : 1;
        return 0;
index 3599063554b6628509e61aff9afc9f5db81dc89e..190e1952e96f917e21c18ca5a3545aad7f26d73d 100644 (file)
@@ -121,6 +121,8 @@ static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP;
 static int clear_decorations_callback(const struct option *opt UNUSED,
                                      const char *arg, int unset)
 {
+       BUG_ON_OPT_NEG(unset);
+       BUG_ON_OPT_ARG(arg);
        string_list_clear(&decorate_refs_include, 0);
        string_list_clear(&decorate_refs_exclude, 0);
        use_default_decoration_filter = 0;