Skip to content

Commit d15aa43

Browse files
Junio C HamanoLinus Torvalds
authored andcommitted
[PATCH] Make -s flag to show-diff a no-op.
With the recent "no-patch-by-default" change, the -s flag to the show-diff command (and silent variable in the show-diff.c) became meaningless. This deprecates it. Cogito uses "show-diff -s" for the purpose of "I do not want the patch text. I just want to know if something has potentially changed, in which case I know you will have some output. I'll run update-cache --refresh if you say something", so we cannot barf on seeing -s on our command line yet. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent ec8f811 commit d15aa43

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

show-diff.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include "cache.h"
77
#include "diff.h"
88

9-
static const char *show_diff_usage = "show-diff [-q] [-s] [-z] [-p] [paths...]";
9+
static const char *show_diff_usage =
10+
"show-diff [-p] [-q] [-r] [-z] [paths...]";
1011

1112
static int generate_patch = 0;
1213
static int line_termination = '\n';
1314
static int silent = 0;
14-
static int silent_on_nonexisting_files = 0;
1515

1616
static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt)
1717
{
@@ -69,16 +69,16 @@ int main(int argc, char **argv)
6969
int i;
7070

7171
while (1 < argc && argv[1][0] == '-') {
72-
if (!strcmp(argv[1], "-s"))
73-
silent_on_nonexisting_files = silent = 1;
74-
else if (!strcmp(argv[1], "-p"))
72+
if (!strcmp(argv[1], "-p"))
7573
generate_patch = 1;
7674
else if (!strcmp(argv[1], "-q"))
77-
silent_on_nonexisting_files = 1;
78-
else if (!strcmp(argv[1], "-z"))
79-
line_termination = 0;
75+
silent = 1;
8076
else if (!strcmp(argv[1], "-r"))
8177
; /* no-op */
78+
else if (!strcmp(argv[1], "-s"))
79+
; /* no-op */
80+
else if (!strcmp(argv[1], "-z"))
81+
line_termination = 0;
8282
else
8383
usage(show_diff_usage);
8484
argv++; argc--;
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
116116
perror(ce->name);
117117
continue;
118118
}
119-
if (silent_on_nonexisting_files)
119+
if (silent)
120120
continue;
121121
show_file('-', ce);
122122
continue;

0 commit comments

Comments
 (0)