aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-08-31 17:17:16 -0400
committerJunio C Hamano <gitster@pobox.com>2023-08-31 15:07:10 -0700
commit7fa701106d485f7bf9d042f822d4366d7059f8ba (patch)
tree0008c61b099c0a96f3ebcfd24ac4b95faf67115e /commit-graph.c
parentmerge: make xopts a strvec (diff)
downloadgit-7fa701106d485f7bf9d042f822d4366d7059f8ba.tar.gz
git-7fa701106d485f7bf9d042f822d4366d7059f8ba.zip
merge: simplify parsing of "-n" option
The "-n" option is implemented by an option callback, as it is really a "reverse bool". If given, it sets show_diffstat to 0. In theory, when negated, it would set the same flag to 1. But it's not possible to trigger that, since short options cannot be negated. So in practice this is really just a SET_INT to 0. Let's use that instead, which shortens the code. Note that negation here would do the wrong thing (as with any SET_INT with a value of "0"). We could specify PARSE_OPT_NONEG to future-proof ourselves against somebody adding a long option name (which would make it possible to negate). But there's not much point: 1. Nobody is going to do that, because the negated form already exists, and is called "--stat" (which is defined separately so that "--no-stat" works). 2. If they did, the BUG() check added by 3284b93862 (parse-options: disallow negating OPTION_SET_INT 0, 2023-08-08) will catch it (and that check is smart enough to realize that our short-only option is OK). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions