Subject: Re: [PATCH v2 1/5] diff: allow --no-patch as synonym for -s

From: Jonathan Nieder <[email-masked]>
Date: Mon, 15 Jul 2013 10:35:36 -0700

Matthieu Moy wrote:

> --- a/diff.c
> +++ b/diff.c
> @@ -3551,7 +3551,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
>  		options->output_format |= DIFF_FORMAT_NAME;
>  	else if (!strcmp(arg, "--name-status"))
>  		options->output_format |= DIFF_FORMAT_NAME_STATUS;
> -	else if (!strcmp(arg, "-s"))
> +	else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch"))
>  		options->output_format |= DIFF_FORMAT_NO_OUTPUT;

Very nice idea.

Tests?  E.g.:

diff --git i/t/t4000-diff-format.sh w/t/t4000-diff-format.sh
index 6ddd469..0fa7380 100755
--- i/t/t4000-diff-format.sh
+++ w/t/t4000-diff-format.sh
@@ -59,4 +59,18 @@ test_expect_success \
     'validate git diff-files -p output.' \
     'compare_diff_patch current expected'
 
+test_expect_success \
+    'git diff-files -s after editing work tree' \
+    '>empty &&
+    git diff-files -s >diff-s-output 2>err &&
+    test_cmp empty diff-s-output &&
+    test_cmp empty err'
+
+test_expect_success \
+    'git diff-files --no-patch as synonym for -s' \
+    '>empty &&
+    git diff-files --no-patch >diff-np-output 2>err &&
+    test_cmp empty diff-np-output &&
+    test_cmp empty err'
+
 test_done