From: Matthieu Moy Date: Wed, 28 Jul 2010 09:41:00 GMT Subject: [PATCH 2/4 v2] Allow detached form for git diff --stat-name-width and --stat-width. Message-ID: <1280310062-16793-2-git-send-email-Matthieu.Moy@imag.fr> In-Reply-To: Signed-off-by: Matthieu Moy --- diff.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/diff.c b/diff.c index 1868b3e..04e97ef 100644 --- a/diff.c +++ 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; int width = options->stat_width; int name_width = options->stat_name_width; @@ -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=")) width = strtoul(arg + 7, &end, 10); + else if (!strcmp(arg, "-name-width")) { + if (!av[1]) + die("Option `--stat-name-width' requires a value"); + name_width = strtoul(av[1], &end, 10); + argcount = 2; + } else if (!prefixcmp(arg, "-name-width=")) name_width = strtoul(arg + 12, &end, 10); break; @@ -3096,6 +3109,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) options->output_format |= DIFF_FORMAT_DIFFSTAT; options->stat_name_width = name_width; options->stat_width = width; + return argcount; } /* renames options */ -- 1.7.2.25.g9ebe3