]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/diff-index-quick-exit-early'
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jun 2011 00:03:11 +0000 (17:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jun 2011 00:03:11 +0000 (17:03 -0700)
* jc/diff-index-quick-exit-early:
  diff-index --quiet: learn the "stop feeding the backend early" logic

Conflicts:
unpack-trees.h

diff-lib.c
unpack-trees.c
unpack-trees.h

index 9c29293bbc05d175ba13338813e8532c7ad677cf..2e09500c8210e22d6c81484aa198f1d811a9933d 100644 (file)
@@ -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;
 }
index 07f83642443601d107e0a2425407b3250c022dcd..3a61d821ee85a9cfb026909c6ae90def360a7681 100644 (file)
@@ -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;
 }
 
index 64f02cb03ab242ac08ea0f1afbb24e71cf6664aa..79989483079970e9dad42512e522eef8ea2a75a4 100644 (file)
@@ -46,6 +46,7 @@ struct unpack_trees_options {
                     debug_unpack,
                     skip_sparse_checkout,
                     gently,
+                    exiting_early,
                     show_all_errors,
                     dry_run;
        const char *prefix;