Skip to content

Commit f253376

Browse files
committed
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
2 parents e10e476 + b419482 commit f253376

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

diff-lib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,13 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
433433
if (tree == o->df_conflict_entry)
434434
tree = NULL;
435435

436-
if (ce_path_match(idx ? idx : tree, &revs->prune_data))
436+
if (ce_path_match(idx ? idx : tree, &revs->prune_data)) {
437437
do_oneway_diff(o, idx, tree);
438+
if (diff_can_quit_early(&revs->diffopt)) {
439+
o->exiting_early = 1;
440+
return -1;
441+
}
442+
}
438443

439444
return 0;
440445
}

unpack-trees.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static int unpack_nondirectories(int n, unsigned long mask,
593593
static int unpack_failed(struct unpack_trees_options *o, const char *message)
594594
{
595595
discard_index(&o->result);
596-
if (!o->gently) {
596+
if (!o->gently && !o->exiting_early) {
597597
if (message)
598598
return error("%s", message);
599599
return -1;
@@ -1133,6 +1133,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
11331133
display_error_msgs(o);
11341134
mark_all_ce_unused(o->src_index);
11351135
ret = unpack_failed(o, NULL);
1136+
if (o->exiting_early)
1137+
ret = 0;
11361138
goto done;
11371139
}
11381140

unpack-trees.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct unpack_trees_options {
4646
debug_unpack,
4747
skip_sparse_checkout,
4848
gently,
49+
exiting_early,
4950
show_all_errors,
5051
dry_run;
5152
const char *prefix;

0 commit comments

Comments
 (0)