aboutsummaryrefslogtreecommitdiffstats
path: root/ref-filter.h
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 /ref-filter.h
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 'ref-filter.h')
-rw-r--r--ref-filter.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/ref-filter.h b/ref-filter.h
index 013d4cfa64..c98c4fbd4c 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -114,11 +114,16 @@ struct ref_format {
}
/* Macros for checking --merged and --no-merged options */
-#define _OPT_MERGED_NO_MERGED(option, filter, h) \
- { OPTION_CALLBACK, 0, option, (filter), N_("commit"), (h), \
- PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, \
- parse_opt_merge_filter, (intptr_t) "HEAD" \
- }
+#define _OPT_MERGED_NO_MERGED(option, filter, h) { \
+ .type = OPTION_CALLBACK, \
+ .long_name = option, \
+ .value = (filter), \
+ .argh = N_("commit"), \
+ .help = (h), \
+ .flags = PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, \
+ .callback = parse_opt_merge_filter, \
+ .defval = (intptr_t) "HEAD", \
+}
#define OPT_MERGED(f, h) _OPT_MERGED_NO_MERGED("merged", f, h)
#define OPT_NO_MERGED(f, h) _OPT_MERGED_NO_MERGED("no-merged", f, h)