summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-03-14 11:12:51 -0700
committerJunio C Hamano <junkio@cox.net>2007-03-14 16:21:19 -0700
commit822cac015589889c1a9e6d49a2c054b7f1b838ba (patch)
tree0ba8c9043054c478ca5ecd210ed752e63d0841fc /diff-lib.c
parent68aacb2f3ceef528ded945b510094918bfe3cb37 (diff)
downloadgit-822cac015589889c1a9e6d49a2c054b7f1b838ba.tar.gz
Teach --quiet to diff backends.
This teaches git-diff-files, git-diff-index and git-diff-tree backends to exit early under --quiet option. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/diff-lib.c b/diff-lib.c
index f9a1a10cc0..5c5b05bfe3 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -324,6 +324,9 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
struct cache_entry *ce = active_cache[i];
int changed;
+ if (revs->diffopt.quiet && revs->diffopt.has_changes)
+ break;
+
if (!ce_path_match(ce, revs->prune_data))
continue;
@@ -565,6 +568,9 @@ static int diff_cache(struct rev_info *revs,
struct cache_entry *ce = *ac;
int same = (entries > 1) && ce_same_name(ce, ac[1]);
+ if (revs->diffopt.quiet && revs->diffopt.has_changes)
+ break;
+
if (!ce_path_match(ce, pathspec))
goto skip_entry;