summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-16 18:23:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-16 18:23:25 (GMT)
commitf253376dcbadb384d8c8af287c3f9e2271cb5ff4 (patch)
tree32382322a78e71a1552daec2d64582647e2190e1
parente10e476fb170a99ecc535a31def69d5e3483a859 (diff)
parentb4194828dc00e97dcd07ecb4bb4f87650a6fca1d (diff)
downloadgit-f253376dcbadb384d8c8af287c3f9e2271cb5ff4.zip
git-f253376dcbadb384d8c8af287c3f9e2271cb5ff4.tar.gz
git-f253376dcbadb384d8c8af287c3f9e2271cb5ff4.tar.bz2
Merge branch 'jc/diff-index-quick-exit-early' into maint
* jc/diff-index-quick-exit-early: diff-index --quiet: learn the "stop feeding the backend early" logic Conflicts: unpack-trees.h
-rw-r--r--diff-lib.c7
-rw-r--r--unpack-trees.c4
-rw-r--r--unpack-trees.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 9c29293..2e09500 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -433,8 +433,13 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
if (tree == o->df_conflict_entry)
tree = NULL;
- if (ce_path_match(idx ? idx : tree, &revs->prune_data))
+ if (ce_path_match(idx ? idx : tree, &revs->prune_data)) {
do_oneway_diff(o, idx, tree);
+ if (diff_can_quit_early(&revs->diffopt)) {
+ o->exiting_early = 1;
+ return -1;
+ }
+ }
return 0;
}
diff --git a/unpack-trees.c b/unpack-trees.c
index e22b9ec..cc616c3 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -593,7 +593,7 @@ static int unpack_nondirectories(int n, unsigned long mask,
static int unpack_failed(struct unpack_trees_options *o, const char *message)
{
discard_index(&o->result);
- if (!o->gently) {
+ if (!o->gently && !o->exiting_early) {
if (message)
return error("%s", message);
return -1;
@@ -1133,6 +1133,8 @@ return_failed:
display_error_msgs(o);
mark_all_ce_unused(o->src_index);
ret = unpack_failed(o, NULL);
+ if (o->exiting_early)
+ ret = 0;
goto done;
}
diff --git a/unpack-trees.h b/unpack-trees.h
index 64f02cb..7998948 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -46,6 +46,7 @@ struct unpack_trees_options {
debug_unpack,
skip_sparse_checkout,
gently,
+ exiting_early,
show_all_errors,
dry_run;
const char *prefix;