git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Johannes SchindelinNext: Linus Torvalds
Message 4 of 6 in “Add "--dirstat" for some directory statistics”
  1. Linus TorvaldsFeb 11, 2008
  2. Linus TorvaldsFeb 11, 2008
  3. Johannes SchindelinFeb 11, 2008
  4. Linus TorvaldsFeb 11, 2008
  5. Linus TorvaldsFeb 11, 2008
  6. Linus TorvaldsFeb 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.