aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/show-branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-24 17:25:33 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-24 17:25:34 -0700
commit2bc5414c411aab33c155b1070b7764ef6a49a02d (patch)
tree3f2b065f7c9c54838ab380ba5d16e7a9f742344b /builtin/show-branch.c
parentMerge branch 'ds/doc-disable-hooks' (diff)
parentparse-options: detect mismatches in integer signedness (diff)
downloadgit-2bc5414c411aab33c155b1070b7764ef6a49a02d.tar.gz
git-2bc5414c411aab33c155b1070b7764ef6a49a02d.zip
Merge branch 'ps/parse-options-integers'
Update parse-options API to catch mistakes to pass address of an integral variable of a wrong type/size. * ps/parse-options-integers: parse-options: detect mismatches in integer signedness parse-options: introduce precision handling for `OPTION_UNSIGNED` parse-options: introduce precision handling for `OPTION_INTEGER` parse-options: rename `OPT_MAGNITUDE()` to `OPT_UNSIGNED()` parse-options: support unit factors in `OPT_INTEGER()` global: use designated initializers for options parse: fix off-by-one for minimum signed values
Diffstat (limited to 'builtin/show-branch.c')
-rw-r--r--builtin/show-branch.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index fce6b404e9..b549d8c3f5 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -667,9 +667,16 @@ int cmd_show_branch(int ac,
N_("show remote-tracking branches")),
OPT__COLOR(&showbranch_use_color,
N_("color '*!+-' corresponding to the branch")),
- { OPTION_INTEGER, 0, "more", &extra, N_("n"),
- N_("show <n> more commits after the common ancestor"),
- PARSE_OPT_OPTARG, NULL, (intptr_t)1 },
+ {
+ .type = OPTION_INTEGER,
+ .long_name = "more",
+ .value = &extra,
+ .precision = sizeof(extra),
+ .argh = N_("n"),
+ .help = N_("show <n> more commits after the common ancestor"),
+ .flags = PARSE_OPT_OPTARG,
+ .defval = 1,
+ },
OPT_SET_INT(0, "list", &extra, N_("synonym to more=-1"), -1),
OPT_BOOL(0, "no-name", &no_name, N_("suppress naming strings")),
OPT_BOOL(0, "current", &with_current_branch,