Re: [PATCH] Add --filedirstat diff option

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Add --filedirstat diff option

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:16

Heikki Orsila [off-list ref] writes:
quoted hunk
@@ -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().

Re: [PATCH] Add --filedirstat diff option

From: Heikki Orsila <hidden>
Date: 2016-06-15 22:45:16

On Mon, Sep 01, 2008 at 11:57:46PM -0700, Junio C Hamano wrote:
Heikki Orsila [off-list ref] writes:
quoted
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help