diff options
| author | René Scharfe <l.s.r@web.de> | 2023-09-02 20:54:54 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-09-05 14:59:26 -0700 |
| commit | 2a63c79dae72b25420bc71116bef7436fd846758 (patch) | |
| tree | dc1c9e6843f814777ba2c249b4479e8da29b1fec /builtin/grep.c | |
| parent | Git 2.42 (diff) | |
| download | git-2a63c79dae72b25420bc71116bef7436fd846758.tar.gz git-2a63c79dae72b25420bc71116bef7436fd846758.zip | |
grep: use OPT_INTEGER_F for --max-depth
a91f453f64 (grep: Add --max-depth option., 2009-07-22) added the option
--max-depth, defining it using a positional struct option initializer of
type OPTION_INTEGER. It also sets defval to 1 for some reason, but that
value would only be used if the flag PARSE_OPT_OPTARG was given.
Use the macro OPT_INTEGER_F instead to standardize the definition and
specify only the necessary values. This also normalizes argh to N_("n")
as a side-effect, which is OK.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
| -rw-r--r-- | builtin/grep.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 50e712a184..f5f5f6dbe1 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -924,9 +924,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) N_("process binary files with textconv filters")), OPT_SET_INT('r', "recursive", &opt.max_depth, N_("search in subdirectories (default)"), -1), - { OPTION_INTEGER, 0, "max-depth", &opt.max_depth, N_("depth"), - N_("descend at most <depth> levels"), PARSE_OPT_NONEG, - NULL, 1 }, + OPT_INTEGER_F(0, "max-depth", &opt.max_depth, + N_("descend at most <n> levels"), PARSE_OPT_NONEG), OPT_GROUP(""), OPT_SET_INT('E', "extended-regexp", &opt.pattern_type_option, N_("use extended POSIX regular expressions"), |
