Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit d09cd15

Browse files
moygitster
authored andcommitted
diff: allow --no-patch as synonym for -s
This follows the usual convention of having a --no-foo option to negate --foo. Signed-off-by: Matthieu Moy <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8ade9b1 commit d09cd15

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Documentation/rev-list-options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,5 +839,6 @@ options may be given. See linkgit:git-diff-files[1] for more options.
839839
Show the tree objects in the diff output. This implies '-r'.
840840

841841
-s::
842+
--no-patch::
842843
Suppress diff output.
843844
endif::git-rev-list[]

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3540,7 +3540,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
35403540
options->output_format |= DIFF_FORMAT_NAME;
35413541
else if (!strcmp(arg, "--name-status"))
35423542
options->output_format |= DIFF_FORMAT_NAME_STATUS;
3543-
else if (!strcmp(arg, "-s"))
3543+
else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch"))
35443544
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
35453545
else if (!prefixcmp(arg, "--stat"))
35463546
/* --stat, --stat-width, --stat-name-width, or --stat-count */

t/t4000-diff-format.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,16 @@ test_expect_success 'validate git diff-files -p output.' '
5959
compare_diff_patch expected actual
6060
'
6161

62+
test_expect_success 'git diff-files -s after editing work tree' '
63+
git diff-files -s >actual 2>err &&
64+
test_must_be_empty actual &&
65+
test_must_be_empty err
66+
'
67+
68+
test_expect_success 'git diff-files --no-patch as synonym for -s' '
69+
git diff-files --no-patch >actual 2>err &&
70+
test_must_be_empty actual &&
71+
test_must_be_empty err
72+
'
73+
6274
test_done

0 commit comments

Comments
 (0)