* [PATCH v2 1/2] diff: alias -q to --quiet
@ 2017-10-13 19:49 Anthony Sottile
2017-10-13 19:49 ` [PATCH v2 2/2] diff: finish removal of deprecated -q option Anthony Sottile
0 siblings, 1 reply; 2+ messages in thread
From: Anthony Sottile @ 2017-10-13 19:49 UTC (permalink / raw)
To: git; +Cc: Anthony Sottile
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 <asottile@umich.edu>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] diff: finish removal of deprecated -q option
2017-10-13 19:49 [PATCH v2 1/2] diff: alias -q to --quiet Anthony Sottile
@ 2017-10-13 19:49 ` Anthony Sottile
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Sottile @ 2017-10-13 19:49 UTC (permalink / raw)
To: git; +Cc: Anthony Sottile
Functionality was removed in c48f6816f0 but the cli option was not removed.
Signed-off-by: Anthony Sottile <asottile@umich.edu>
---
builtin/diff-files.c | 2 --
builtin/diff.c | 2 --
diff.h | 4 +---
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index e88493f..b0ff251 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -37,8 +37,6 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
rev.max_count = 2;
else if (!strcmp(argv[1], "--theirs"))
rev.max_count = 3;
- else if (!strcmp(argv[1], "-q"))
- options |= DIFF_SILENT_ON_REMOVED;
else
usage(diff_files_usage);
argv++; argc--;
diff --git a/builtin/diff.c b/builtin/diff.c
index f5bbd4d..96513e8 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -227,8 +227,6 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
revs->max_count = 2;
else if (!strcmp(argv[1], "--theirs"))
revs->max_count = 3;
- else if (!strcmp(argv[1], "-q"))
- options |= DIFF_SILENT_ON_REMOVED;
else if (!strcmp(argv[1], "-h"))
usage(builtin_diff_usage);
else
diff --git a/diff.h b/diff.h
index aca150b..c9d71e1 100644
--- a/diff.h
+++ b/diff.h
@@ -65,7 +65,7 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
#define DIFF_OPT_BINARY (1 << 2)
#define DIFF_OPT_TEXT (1 << 3)
#define DIFF_OPT_FULL_INDEX (1 << 4)
-#define DIFF_OPT_SILENT_ON_REMOVE (1 << 5)
+/* (1 << 5) unused */
#define DIFF_OPT_FIND_COPIES_HARDER (1 << 6)
#define DIFF_OPT_FOLLOW_RENAMES (1 << 7)
#define DIFF_OPT_RENAME_EMPTY (1 << 8)
@@ -374,8 +374,6 @@ extern void diff_warn_rename_limit(const char *varname, int needed, int degraded
*/
extern const char *diff_aligned_abbrev(const struct object_id *sha1, int);
-/* do not report anything on removed paths */
-#define DIFF_SILENT_ON_REMOVED 01
/* report racily-clean paths as modified */
#define DIFF_RACY_IS_MODIFIED 02
extern int run_diff_files(struct rev_info *revs, unsigned int option);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-13 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 19:49 [PATCH v2 1/2] diff: alias -q to --quiet Anthony Sottile
2017-10-13 19:49 ` [PATCH v2 2/2] diff: finish removal of deprecated -q option Anthony Sottile
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).