Re: [PATCH 2/4 v2] Allow detached form for git diff --stat-name-width and --stat-width.
> diff.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
Show 7 quoted lines
> +++ b/diff.c
> @@ -3071,6 +3071,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
> else if (!strcmp(arg, "-s"))
> options->output_format |= DIFF_FORMAT_NO_OUTPUT;
> else if (!prefixcmp(arg, "--stat")) {
> + argcount = 1;
> char *end;declaration after statement.
Show 11 quoted lines
> @@ -3079,8 +3080,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>
> switch (*arg) {
> case '-':
> + if (!strcmp(arg, "-width")) {
> + if (!av[1])
> + die("Option `--stat-width' requires a value");
> + width = strtoul(av[1], &end, 10);
> + argcount = 2;
> + }
> if (!prefixcmp(arg, "-width="))Could save an extra string comparison with an "else" here.
[...]
> + name_width = strtoul(av[1], &end, 10);
> + argcount = 2;
> + }
Whitespace damage: trailing tabs.
How about something like the following?
Jonathan Nieder (1):
diff: split off a function for --stat-* option parsing
Matthieu Moy (1):
diff: allow --stat-width n, --stat-name-width n
diff.c | 80 ++++++++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 27 deletions(-)