diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-04-24 17:25:33 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-04-24 17:25:34 -0700 |
| commit | 2bc5414c411aab33c155b1070b7764ef6a49a02d (patch) | |
| tree | 3f2b065f7c9c54838ab380ba5d16e7a9f742344b /builtin/gc.c | |
| parent | 68e5342e191a2de216dbf712a6dbfa49282429c4 (diff) | |
| parent | 791aeddfa2fdb9e830e24c50c97bb5e8bf3613e6 (diff) | |
| download | git-2bc5414c411aab33c155b1070b7764ef6a49a02d.tar.gz | |
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/gc.c')
| -rw-r--r-- | builtin/gc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index b5ce1d3276..856dd50559 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -743,12 +743,18 @@ struct repository *repo UNUSED) int ret; struct option builtin_gc_options[] = { OPT__QUIET(&quiet, N_("suppress progress reporting")), - { OPTION_STRING, 0, "prune", &prune_expire_arg, N_("date"), - N_("prune unreferenced objects"), - PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire_arg }, + { + .type = OPTION_STRING, + .long_name = "prune", + .value = &prune_expire_arg, + .argh = N_("date"), + .help = N_("prune unreferenced objects"), + .flags = PARSE_OPT_OPTARG, + .defval = (intptr_t)prune_expire_arg, + }, OPT_BOOL(0, "cruft", &cfg.cruft_packs, N_("pack unreferenced objects separately")), - OPT_MAGNITUDE(0, "max-cruft-size", &cfg.max_cruft_size, - N_("with --cruft, limit the size of new cruft packs")), + OPT_UNSIGNED(0, "max-cruft-size", &cfg.max_cruft_size, + N_("with --cruft, limit the size of new cruft packs")), OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")), OPT_BOOL_F(0, "auto", &opts.auto_flag, N_("enable auto-gc mode"), PARSE_OPT_NOCOMPLETE), |
