@matheusbsbs / matheus-bagliano / commits / 822cac0155
Fork 0

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>

Junio C Hamano committed Mar 14, 2007 at 11:12 UTC 822cac015589889c1a9e6d49a2c054b7f1b838ba
2 files changed +8
diff-lib.c
+6
@@ -324,6 +324,9 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
324 struct cache_entry *ce = active_cache[i];
325 int changed;
326
327 + if (revs->diffopt.quiet && revs->diffopt.has_changes)
328 + break;
329 +
330 if (!ce_path_match(ce, revs->prune_data))
331 continue;
332
@@ -565,6 +568,9 @@ static int diff_cache(struct rev_info *revs,
568 struct cache_entry *ce = *ac;
569 int same = (entries > 1) && ce_same_name(ce, ac[1]);
570
571 + if (revs->diffopt.quiet && revs->diffopt.has_changes)
572 + break;
573 +
574 if (!ce_path_match(ce, pathspec))
575 goto skip_entry;
576
tree-diff.c
+2
@@ -161,6 +161,8 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree
161 int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, struct diff_options *opt)
162 {
163 while (t1->size | t2->size) {
164 + if (opt->quiet && opt->has_changes)
165 + break;
166 if (opt->nr_paths && t1->size && !interesting(t1, base, opt)) {
167 update_tree_entry(t1);
168 continue;