Previously, `-q` was silently ignored:
Before:
$ git diff -q -- Documentation/; echo $?
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index a88c767..aa6e724 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -587,6 +587,7 @@ ifndef::git-log[]
That is, it exits with 1 if there were differences and
0 means no differences.
+-q::
--quiet::
Disable all output of the program. Implies `--exit-code`.
endif::git-log[]
0
$
After:
$ ./git diff -q -- Documentation/; echo $?
1
$
Signed-off-by: Anthony Sottile <[email protected]>
---
Documentation/diff-options.txt | 1 +
diff.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index a88c767..aa6e724 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -587,6 +587,7 @@ ifndef::git-log[]
That is, it exits with 1 if there were differences and
0 means no differences.
+-q::
--quiet::
Disable all output of the program. Implies `--exit-code`.
endif::git-log[]
diff --git a/diff.c b/diff.c
index 69f0357..13dfc3e 100644
--- a/diff.c
+++ b/diff.c
@@ -4751,7 +4751,7 @@ int diff_opt_parse(struct diff_options *options,
}
else if (!strcmp(arg, "--exit-code"))
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
- else if (!strcmp(arg, "--quiet"))
+ else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
DIFF_OPT_SET(options, QUICK);
else if (!strcmp(arg, "--ext-diff"))
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
--
2.7.4