Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff-parseopt: convert --numstat and --shortstat
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 16 Feb 2019 11:36:36 +0000
(18:36 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 20 Feb 2019 20:32:53 +0000
(12:32 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
c659f30
)
diff --git
a/diff.c
b/diff.c
index 12e333c67f5105d5b91ba63d381584e9fc8274ec..419b6ac4aea84eca8652446cf367ab4c83483f5d 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-4905,6
+4905,12
@@
static void prep_parse_options(struct diff_options *options)
N_("synonym for '-p --raw'"),
DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW,
DIFF_FORMAT_NO_OUTPUT),
N_("synonym for '-p --raw'"),
DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW,
DIFF_FORMAT_NO_OUTPUT),
+ OPT_BIT_F(0, "numstat", &options->output_format,
+ N_("machine friendly --stat"),
+ DIFF_FORMAT_NUMSTAT, PARSE_OPT_NONEG),
+ OPT_BIT_F(0, "shortstat", &options->output_format,
+ N_("output only the last line of --stat"),
+ DIFF_FORMAT_SHORTSTAT, PARSE_OPT_NONEG),
OPT_END()
};
OPT_END()
};
@@
-4933,11
+4939,7
@@
int diff_opt_parse(struct diff_options *options,
return ac;
/* Output format options */
return ac;
/* Output format options */
- if (!strcmp(arg, "--numstat"))
- options->output_format |= DIFF_FORMAT_NUMSTAT;
- else if (!strcmp(arg, "--shortstat"))
- options->output_format |= DIFF_FORMAT_SHORTSTAT;
- else if (skip_prefix(arg, "-X", &arg) ||
+ if (skip_prefix(arg, "-X", &arg) ||
skip_to_optional_arg(arg, "--dirstat", &arg))
return parse_dirstat_opt(options, arg);
else if (!strcmp(arg, "--cumulative"))
skip_to_optional_arg(arg, "--dirstat", &arg))
return parse_dirstat_opt(options, arg);
else if (!strcmp(arg, "--cumulative"))