Re: Add "--dirstat" for some directory statistics
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Feb 11, 2008, 21:41 UTC
- Message-ID
- <alpine.LFD.1.00.0802111338270.2920@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LSU.1.00.0802112122300.3870@racer.site>
On Mon, 11 Feb 2008, Johannes Schindelin wrote:
> > Certainly you meant 0x0040 for DIRSTAT, n'est-ce pas?
Yeah, yeah.
> Also, are you sure that you do not want to make the minimal percentage > configurable, maybe with --dirstat[=<min-percent>]? I mean, sometimes > even 0.01% is worth showing.
Well, maybe, maybe not. But yeah, at least in whole percentages. Here is a simple patch to fix that cut-and-past'o and add a configurable (but still whole-percentage-point) thing.
Linus
--- diff.c | 2 +- diff.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c index da91bdd..81948e7 100644 --- a/diff.c +++ b/diff.c @@ -2273,7 +2273,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) options->output_format |= DIFF_FORMAT_NUMSTAT; else if (!strcmp(arg, "--shortstat")) options->output_format |= DIFF_FORMAT_SHORTSTAT; - else if (!strcmp(arg, "--dirstat")) + else if (opt_arg(arg, 'X', "dirstat", &options->dirstat_percent)) options->output_format |= DIFF_FORMAT_DIRSTAT; else if (!strcmp(arg, "--check")) options->output_format |= DIFF_FORMAT_CHECKDIFF; diff --git a/diff.h b/diff.h index 3181263..9da6601 100644 --- a/diff.h +++ b/diff.h @@ -30,7 +30,7 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q, #define DIFF_FORMAT_SUMMARY 0x0008 #define DIFF_FORMAT_PATCH 0x0010 #define DIFF_FORMAT_SHORTSTAT 0x0020 -#define DIFF_FORMAT_DIRSTAT 0x0020 +#define DIFF_FORMAT_DIRSTAT 0x0040 /* These override all above */ #define DIFF_FORMAT_NAME 0x0100