git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add --filedirstat diff option
@ 2008-09-01  1:12 Heikki Orsila
  2008-09-02  6:57 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Orsila @ 2008-09-01  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

--filedirstat is the same as --dirstat, but it counts "damaged files"
instead of "damaged lines" (lines that are added or removed).

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
---
Example of Linux v2.6.25..v2.6.26:

$ git diff --filedirstat v2.6.25..v2.6.26 
   3.3% arch/arm/
   6.0% arch/powerpc/
   3.8% arch/x86/
  12.1% arch/
   3.4% drivers/media/video/
   6.8% drivers/net/
  26.5% drivers/
   6.4% fs/
   4.5% include/linux/
  13.0% include/
   5.9% net/

$ git diff --dirstat v2.6.25..v2.6.26 
   4.9% arch/arm/
   9.0% arch/powerpc/configs/
  14.6% arch/
   5.0% drivers/media/video/
   4.2% drivers/media/
   5.5% drivers/net/sk98lin/
   6.6% drivers/net/wireless/
   5.7% drivers/net/
   4.8% drivers/s390/net/
  17.8% drivers/
   6.4% include/
   5.1% net/


 Documentation/diff-options.txt |    3 +++
 diff.c                         |   11 +++++++++--
 diff.h                         |    1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 1759386..6e84f40 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -66,6 +66,9 @@ endif::git-format-patch[]
 	the "--cumulative" flag, which adds up percentages recursively
 	even when they have been already reported for a sub-directory.
 
+--filedirstat[=limit]::
+	Same as --dirstat, but count changed files instead of lines.
+
 --summary::
 	Output a condensed summary of extended header information
 	such as creations, renames and mode changes.
diff --git a/diff.c b/diff.c
index 135dec4..48f33d6 100644
--- a/diff.c
+++ b/diff.c
@@ -1110,9 +1110,13 @@ static void show_dirstat(struct diff_options *options)
 		/*
 		 * Original minus copied is the removed material,
 		 * added is the new material.  They are both damages
-		 * made to the preimage.
+		 * made to the preimage. In --filedirstat mode, count
+		 * damaged files, not damaged lines. This is done by
+		 * counting only a single damaged line per file.
 		 */
 		damage = (p->one->size - copied) + added;
+		if (options->filedirstat && damage > 0)
+			damage = 1;
 
 		ALLOC_GROW(dir.files, dir.nr + 1, dir.alloc);
 		dir.files[dir.nr].name = name;
@@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		options->output_format |= DIFF_FORMAT_DIRSTAT;
 	else if (!strcmp(arg, "--cumulative"))
 		options->output_format |= DIFF_FORMAT_CUMULATIVE;
-	else if (!strcmp(arg, "--check"))
+	else if (opt_arg(arg, 'X', "filedirstat", &options->dirstat_percent)) {
+		options->output_format |= DIFF_FORMAT_DIRSTAT;
+		options->filedirstat = 1;
+	} else if (!strcmp(arg, "--check"))
 		options->output_format |= DIFF_FORMAT_CHECKDIFF;
 	else if (!strcmp(arg, "--summary"))
 		options->output_format |= DIFF_FORMAT_SUMMARY;
diff --git a/diff.h b/diff.h
index 50fb5dd..2832bb8 100644
--- a/diff.h
+++ b/diff.h
@@ -86,6 +86,7 @@ struct diff_options {
 	int rename_limit;
 	int warn_on_too_large_rename;
 	int dirstat_percent;
+	int filedirstat;
 	int setup;
 	int abbrev;
 	const char *prefix;
-- 
1.6.0.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-01  1:12 [PATCH] Add --filedirstat diff option Heikki Orsila
@ 2008-09-02  6:57 ` Junio C Hamano
  2008-09-02 11:58   ` Heikki Orsila
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-09-02  6:57 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

Heikki Orsila <heikki.orsila@iki.fi> writes:

> @@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>  		options->output_format |= DIFF_FORMAT_DIRSTAT;
>  	else if (!strcmp(arg, "--cumulative"))
>  		options->output_format |= DIFF_FORMAT_CUMULATIVE;
> -	else if (!strcmp(arg, "--check"))
> +	else if (opt_arg(arg, 'X', "filedirstat", &options->dirstat_percent)) {
> +		options->output_format |= DIFF_FORMAT_DIRSTAT;
> +		options->filedirstat = 1;

Why 'X'?  It would never match, confusing to the reader, and risks a
sudden change in behaviour when these statements are reordered or somebody
mechanically attempts to convert this to parse_options().

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-02  6:57 ` Junio C Hamano
@ 2008-09-02 11:58   ` Heikki Orsila
  2008-09-02 23:40     ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Orsila @ 2008-09-02 11:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Mon, Sep 01, 2008 at 11:57:46PM -0700, Junio C Hamano wrote:
> Heikki Orsila <heikki.orsila@iki.fi> writes:
> 
> > @@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
> >  		options->output_format |= DIFF_FORMAT_DIRSTAT;
> >  	else if (!strcmp(arg, "--cumulative"))
> >  		options->output_format |= DIFF_FORMAT_CUMULATIVE;
> > -	else if (!strcmp(arg, "--check"))
> > +	else if (opt_arg(arg, 'X', "filedirstat", &options->dirstat_percent)) {
> > +		options->output_format |= DIFF_FORMAT_DIRSTAT;
> > +		options->filedirstat = 1;
> 
> Why 'X'?  It would never match, confusing to the reader, and risks a
> sudden change in behaviour when these statements are reordered or somebody
> mechanically attempts to convert this to parse_options().

This is embarrassing.. I just copied the previous "dirstat" line.. 
*grin*

Anyway, what about the concept of filedirstat? Is it agreeable?

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-02 11:58   ` Heikki Orsila
@ 2008-09-02 23:40     ` Junio C Hamano
  2008-09-02 23:55       ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-09-02 23:40 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

Heikki Orsila <shd@modeemi.fi> writes:

> On Mon, Sep 01, 2008 at 11:57:46PM -0700, Junio C Hamano wrote:
>> Heikki Orsila <heikki.orsila@iki.fi> writes:
>> 
>> > @@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>> >  		options->output_format |= DIFF_FORMAT_DIRSTAT;
>> >  	else if (!strcmp(arg, "--cumulative"))
>> >  		options->output_format |= DIFF_FORMAT_CUMULATIVE;
>> > -	else if (!strcmp(arg, "--check"))
>> > +	else if (opt_arg(arg, 'X', "filedirstat", &options->dirstat_percent)) {
>> > +		options->output_format |= DIFF_FORMAT_DIRSTAT;
>> > +		options->filedirstat = 1;
>> 
>> Why 'X'?  It would never match, confusing to the reader, and risks a
>> sudden change in behaviour when these statements are reordered or somebody
>> mechanically attempts to convert this to parse_options().
>
> This is embarrassing.. I just copied the previous "dirstat" line.. 
> *grin*
>
> Anyway, what about the concept of filedirstat? Is it agreeable?

I am neutral.

I do not think the additional code hurts anybody, so I wouldn't say I do
not want to have the patch anywhere near my tree, but on the other hand,
personally I do not find the feature as interesting or useful as dirstat.

Maybe there are many others who do find this option useful.  I dunno.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] Add --filedirstat diff option
@ 2008-09-02 23:51 Heikki Orsila
  0 siblings, 0 replies; 13+ messages in thread
From: Heikki Orsila @ 2008-09-02 23:51 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

--filedirstat is the same as --dirstat, but it counts "damaged files"
instead of "damaged lines" (lines that are added or removed).

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
---
This is version 2 of the patch. It fixes --filedirstat option handling.

 Documentation/diff-options.txt |    3 +++
 diff.c                         |   11 +++++++++--
 diff.h                         |    1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 1759386..6e84f40 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -66,6 +66,9 @@ endif::git-format-patch[]
 	the "--cumulative" flag, which adds up percentages recursively
 	even when they have been already reported for a sub-directory.
 
+--filedirstat[=limit]::
+	Same as --dirstat, but count changed files instead of lines.
+
 --summary::
 	Output a condensed summary of extended header information
 	such as creations, renames and mode changes.
diff --git a/diff.c b/diff.c
index 135dec4..393dea7 100644
--- a/diff.c
+++ b/diff.c
@@ -1110,9 +1110,13 @@ static void show_dirstat(struct diff_options *options)
 		/*
 		 * Original minus copied is the removed material,
 		 * added is the new material.  They are both damages
-		 * made to the preimage.
+		 * made to the preimage. In --filedirstat mode, count
+		 * damaged files, not damaged lines. This is done by
+		 * counting only a single damaged line per file.
 		 */
 		damage = (p->one->size - copied) + added;
+		if (options->filedirstat && damage > 0)
+			damage = 1;
 
 		ALLOC_GROW(dir.files, dir.nr + 1, dir.alloc);
 		dir.files[dir.nr].name = name;
@@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		options->output_format |= DIFF_FORMAT_DIRSTAT;
 	else if (!strcmp(arg, "--cumulative"))
 		options->output_format |= DIFF_FORMAT_CUMULATIVE;
-	else if (!strcmp(arg, "--check"))
+	else if (opt_arg(arg, 0, "filedirstat", &options->dirstat_percent)) {
+		options->output_format |= DIFF_FORMAT_DIRSTAT;
+		options->filedirstat = 1;
+	} else if (!strcmp(arg, "--check"))
 		options->output_format |= DIFF_FORMAT_CHECKDIFF;
 	else if (!strcmp(arg, "--summary"))
 		options->output_format |= DIFF_FORMAT_SUMMARY;
diff --git a/diff.h b/diff.h
index 50fb5dd..2832bb8 100644
--- a/diff.h
+++ b/diff.h
@@ -86,6 +86,7 @@ struct diff_options {
 	int rename_limit;
 	int warn_on_too_large_rename;
 	int dirstat_percent;
+	int filedirstat;
 	int setup;
 	int abbrev;
 	const char *prefix;
-- 
1.6.0.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-02 23:40     ` Junio C Hamano
@ 2008-09-02 23:55       ` Junio C Hamano
  2008-09-03  0:08         ` Heikki Orsila
  2008-09-03  0:12         ` Jeff King
  0 siblings, 2 replies; 13+ messages in thread
From: Junio C Hamano @ 2008-09-02 23:55 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Heikki Orsila <shd@modeemi.fi> writes:
>
>> On Mon, Sep 01, 2008 at 11:57:46PM -0700, Junio C Hamano wrote:
>>> Heikki Orsila <heikki.orsila@iki.fi> writes:
>>> 
>>> > @@ -2474,7 +2478,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>>> >  		options->output_format |= DIFF_FORMAT_DIRSTAT;
>>> >  	else if (!strcmp(arg, "--cumulative"))
>>> >  		options->output_format |= DIFF_FORMAT_CUMULATIVE;
>>> > -	else if (!strcmp(arg, "--check"))
>>> > +	else if (opt_arg(arg, 'X', "filedirstat", &options->dirstat_percent)) {
>>> > +		options->output_format |= DIFF_FORMAT_DIRSTAT;
>>> > +		options->filedirstat = 1;
>>> 
>>> Why 'X'?  It would never match, confusing to the reader, and risks a
>>> sudden change in behaviour when these statements are reordered or somebody
>>> mechanically attempts to convert this to parse_options().
>>
>> This is embarrassing.. I just copied the previous "dirstat" line.. 
>> *grin*
>>
>> Anyway, what about the concept of filedirstat? Is it agreeable?
>
> I am neutral.
>
> I do not think the additional code hurts anybody, so I wouldn't say I do
> not want to have the patch anywhere near my tree, but on the other hand,
> personally I do not find the feature as interesting or useful as dirstat.
>
> Maybe there are many others who do find this option useful.  I dunno.

While I was thinking about potential issues before queuing this, I
realized that I forgot to mention one thing.

The name.

"filedirstat" is simply too long to type, and it has a certain "Huh?"
factor --- is it about file, or is it about directory?

This option essentially is just the dirstat but with different logic to
compute how big the damage is.  Conceptually, the original one gives one
"damage point" to each added or deleted line.

        $ git show --dirstat=<one-point-per-line>

and yours awards one point to each file, whatever the size of the damage
is.

        $ git show --dirstat=<one-point-per-file>

I cannot come up with a short-and-sweet name for one-point-per-X offhand,
but expressing this variant as an option to --dirstat will leave the door
open for other people to come up with different system to award damage
points.  Perhaps

	$ git show --dirstat=exclude-typofixes

might even be not just interesting but useful ;-)

Again, I mention this not because I want to reject the patch, but because
I hope other people with better UI taste may come up with an alternative
before I finish handling other patches.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-02 23:55       ` Junio C Hamano
@ 2008-09-03  0:08         ` Heikki Orsila
  2008-09-03  0:28           ` Re* " Junio C Hamano
  2008-09-03  0:12         ` Jeff King
  1 sibling, 1 reply; 13+ messages in thread
From: Heikki Orsila @ 2008-09-03  0:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Sep 02, 2008 at 04:55:39PM -0700, Junio C Hamano wrote:
> realized that I forgot to mention one thing.
> 
> The name.
> 
> "filedirstat" is simply too long to type, and it has a certain "Huh?"
> factor --- is it about file, or is it about directory?
> 
> This option essentially is just the dirstat but with different logic to
> compute how big the damage is.  Conceptually, the original one gives one
> "damage point" to each added or deleted line.
> 
>         $ git show --dirstat=<one-point-per-line>
> 
> and yours awards one point to each file, whatever the size of the damage
> is.
> 
>         $ git show --dirstat=<one-point-per-file>
> 
> I cannot come up with a short-and-sweet name for one-point-per-X offhand,
> but expressing this variant as an option to --dirstat will leave the door
> open for other people to come up with different system to award damage
> points.  Perhaps
> 
> 	$ git show --dirstat=exclude-typofixes
> 
> might even be not just interesting but useful ;-)

I wouldn't add new semantics for --dirstat=x since it's easy to add 
new options. We already have --cumulative, so adding options is not 
new. How about "--dirstat --filemode"? It's long, but it is obvious. I 
don't think length is relevant here. A shorter but obscure syntax would 
be "--dirstat2" :-) 

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-02 23:55       ` Junio C Hamano
  2008-09-03  0:08         ` Heikki Orsila
@ 2008-09-03  0:12         ` Jeff King
  2008-09-03  0:18           ` Heikki Orsila
  2008-09-03  0:44           ` Junio C Hamano
  1 sibling, 2 replies; 13+ messages in thread
From: Jeff King @ 2008-09-03  0:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Heikki Orsila, git

On Tue, Sep 02, 2008 at 04:55:39PM -0700, Junio C Hamano wrote:

> "filedirstat" is simply too long to type, and it has a certain "Huh?"
> factor --- is it about file, or is it about directory?

I had the same thought when I saw the original patch...

> This option essentially is just the dirstat but with different logic to
> compute how big the damage is.  Conceptually, the original one gives one
> "damage point" to each added or deleted line.
> 
>         $ git show --dirstat=<one-point-per-line>

...and I thought of --dirstat-byfile. So maybe:

  --dirstat=byfile

and

  --dirstat=byline

defaulting to byline (or by-line if preferred).

-Peff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-03  0:12         ` Jeff King
@ 2008-09-03  0:18           ` Heikki Orsila
  2008-09-03  0:44           ` Junio C Hamano
  1 sibling, 0 replies; 13+ messages in thread
From: Heikki Orsila @ 2008-09-03  0:18 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git

On Tue, Sep 02, 2008 at 08:12:54PM -0400, Jeff King wrote:
> ...and I thought of --dirstat-byfile. So maybe:

I like --dirstat-byfile more than --dirstat=byfile as dirstat already 
takes a cut-off percent parameter.

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re* [PATCH] Add --filedirstat diff option
  2008-09-03  0:08         ` Heikki Orsila
@ 2008-09-03  0:28           ` Junio C Hamano
  2008-09-03  0:39             ` Heikki Orsila
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-09-03  0:28 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

Heikki Orsila <shd@modeemi.fi> writes:

> I wouldn't add new semantics for --dirstat=x since it's easy to add 
> new options. We already have --cumulative, so adding options is not 
> new. How about "--dirstat --filemode"? It's long, but it is obvious. I 
> don't think length is relevant here. A shorter but obscure syntax would 
> be "--dirstat2" :-) 

I wouldn't actually buy "easy to add" argument.  Following the
easiest-to-implement path down often result in inconsistent and messy UI.

IOW, I may use that expression from time to time like: "while it may be
easy to add another option, that would lead to many options that depend on
other options, with a messy end result", in a negative sense.

But you are right to point out that --cumulative is an option that affects
how --dirstat operates.  And I think the option parsing of that code is
buggy.  It should imply --dirstat, shouldn't it?

So I do not mind --filemode or whatever option that is expressed as a
word on the command line separate from --dirstat, but we really should
consider this and --cumulative conceptually a sub-option to --dirstat.

Here is a sample patch to fix --cumulative (but of course it is untested);
I think your --filemode (or whatever its final name is) should hook into
the same place as this patch touches, as far as command line parsing is
concerned.

-- >8 --
diff --cumulative is a sub-option of --dirstat

The option used to be implemented as if it is a totally independent one,
but "git diff --cumulative" would not mean anything without "--dirstat".

This makes --cumulative imply --dirstat.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c |    9 ++++++---
 diff.h |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git c/diff.c w/diff.c
index 135dec4..cbd151b 100644
--- c/diff.c
+++ w/diff.c
@@ -1078,7 +1078,7 @@ static void show_dirstat(struct diff_options *options)
 	dir.alloc = 0;
 	dir.nr = 0;
 	dir.percent = options->dirstat_percent;
-	dir.cumulative = options->output_format & DIFF_FORMAT_CUMULATIVE;
+	dir.cumulative = DIFF_OPT_TST(options, DIRSTAT_CUMULATIVE);
 
 	changed = 0;
 	for (i = 0; i < q->nr; i++) {
@@ -2300,6 +2300,7 @@ void diff_setup(struct diff_options *options)
 	options->break_opt = -1;
 	options->rename_limit = -1;
 	options->dirstat_percent = 3;
+	DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
 	options->context = 3;
 
 	options->change = diff_change;
@@ -2472,8 +2473,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		options->output_format |= DIFF_FORMAT_SHORTSTAT;
 	else if (opt_arg(arg, 'X', "dirstat", &options->dirstat_percent))
 		options->output_format |= DIFF_FORMAT_DIRSTAT;
-	else if (!strcmp(arg, "--cumulative"))
-		options->output_format |= DIFF_FORMAT_CUMULATIVE;
+	else if (!strcmp(arg, "--cumulative")) {
+		options->output_format |= DIFF_FORMAT_DIRSTAT;
+		DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
+	}
 	else if (!strcmp(arg, "--check"))
 		options->output_format |= DIFF_FORMAT_CHECKDIFF;
 	else if (!strcmp(arg, "--summary"))
diff --git c/diff.h w/diff.h
index 50fb5dd..7f53beb 100644
--- c/diff.h
+++ w/diff.h
@@ -31,7 +31,6 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
 #define DIFF_FORMAT_PATCH	0x0010
 #define DIFF_FORMAT_SHORTSTAT	0x0020
 #define DIFF_FORMAT_DIRSTAT	0x0040
-#define DIFF_FORMAT_CUMULATIVE	0x0080
 
 /* These override all above */
 #define DIFF_FORMAT_NAME	0x0100
@@ -64,6 +63,7 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
 #define DIFF_OPT_CHECK_FAILED        (1 << 16)
 #define DIFF_OPT_RELATIVE_NAME       (1 << 17)
 #define DIFF_OPT_IGNORE_SUBMODULES   (1 << 18)
+#define DIFF_OPT_DIRSTAT_CUMULATIVE  (1 << 19)
 #define DIFF_OPT_TST(opts, flag)    ((opts)->flags & DIFF_OPT_##flag)
 #define DIFF_OPT_SET(opts, flag)    ((opts)->flags |= DIFF_OPT_##flag)
 #define DIFF_OPT_CLR(opts, flag)    ((opts)->flags &= ~DIFF_OPT_##flag)

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Re* [PATCH] Add --filedirstat diff option
  2008-09-03  0:28           ` Re* " Junio C Hamano
@ 2008-09-03  0:39             ` Heikki Orsila
  0 siblings, 0 replies; 13+ messages in thread
From: Heikki Orsila @ 2008-09-03  0:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Sep 02, 2008 at 05:28:59PM -0700, Junio C Hamano wrote:
> But you are right to point out that --cumulative is an option that affects
> how --dirstat operates.  And I think the option parsing of that code is
> buggy.  It should imply --dirstat, shouldn't it?

Yes.

> Here is a sample patch to fix --cumulative (but of course it is untested);
> I think your --filemode (or whatever its final name is) should hook into
> the same place as this patch touches, as far as command line parsing is
> concerned.

I'll prepare something later today..

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-03  0:12         ` Jeff King
  2008-09-03  0:18           ` Heikki Orsila
@ 2008-09-03  0:44           ` Junio C Hamano
  2008-09-03 12:47             ` Jeff King
  1 sibling, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-09-03  0:44 UTC (permalink / raw)
  To: Jeff King; +Cc: Heikki Orsila, git

Jeff King <peff@peff.net> writes:

> On Tue, Sep 02, 2008 at 04:55:39PM -0700, Junio C Hamano wrote:
>
>> "filedirstat" is simply too long to type, and it has a certain "Huh?"
>> factor --- is it about file, or is it about directory?
>
> I had the same thought when I saw the original patch...
>
>> This option essentially is just the dirstat but with different logic to
>> compute how big the damage is.  Conceptually, the original one gives one
>> "damage point" to each added or deleted line.
>> 
>>         $ git show --dirstat=<one-point-per-line>
>
> ...and I thought of --dirstat-byfile. So maybe:
>
>   --dirstat=byfile
>
> and
>
>   --dirstat=byline
>
> defaulting to byline (or by-line if preferred).

As Heikki points out (and I missed this initially myself), --dirstat[=x]
already exists and it gives the cut-off-point.

Perhaps "--dirstat-by-file" that implies "--dirstat" (with the
understanding (and documentation) that "--dirstat" is a shorthand for
"--dirstat-by-line" that does not exist)?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add --filedirstat diff option
  2008-09-03  0:44           ` Junio C Hamano
@ 2008-09-03 12:47             ` Jeff King
  0 siblings, 0 replies; 13+ messages in thread
From: Jeff King @ 2008-09-03 12:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Heikki Orsila, git

On Tue, Sep 02, 2008 at 05:44:55PM -0700, Junio C Hamano wrote:

> Perhaps "--dirstat-by-file" that implies "--dirstat" (with the
> understanding (and documentation) that "--dirstat" is a shorthand for
> "--dirstat-by-line" that does not exist)?

Makes sense to me.

-Peff

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-09-03 12:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-01  1:12 [PATCH] Add --filedirstat diff option Heikki Orsila
2008-09-02  6:57 ` Junio C Hamano
2008-09-02 11:58   ` Heikki Orsila
2008-09-02 23:40     ` Junio C Hamano
2008-09-02 23:55       ` Junio C Hamano
2008-09-03  0:08         ` Heikki Orsila
2008-09-03  0:28           ` Re* " Junio C Hamano
2008-09-03  0:39             ` Heikki Orsila
2008-09-03  0:12         ` Jeff King
2008-09-03  0:18           ` Heikki Orsila
2008-09-03  0:44           ` Junio C Hamano
2008-09-03 12:47             ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2008-09-02 23:51 Heikki Orsila

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).