Thread (18 messages) 18 messages, 3 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:58:10

Matthieu Moy wrote:
quoted hunk ↗ jump to hunk
--- 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help