зеркало из https://github.com/microsoft/git.git
Merge branch 'jk/diff-not-so-quick'
* jk/diff-not-so-quick: diff: futureproof "stop feeding the backend early" logic diff_tree: disable QUICK optimization with diff filter Conflicts: diff.c
This commit is contained in:
Коммит
456a4c08b8
|
@ -102,9 +102,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||||
int changed;
|
int changed;
|
||||||
unsigned dirty_submodule = 0;
|
unsigned dirty_submodule = 0;
|
||||||
|
|
||||||
if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
|
if (diff_can_quit_early(&revs->diffopt))
|
||||||
!revs->diffopt.filter &&
|
|
||||||
DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!ce_path_match(ce, &revs->prune_data))
|
if (!ce_path_match(ce, &revs->prune_data))
|
||||||
|
|
7
diff.c
7
diff.c
|
@ -4456,6 +4456,13 @@ int diff_result_code(struct diff_options *opt, int status)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int diff_can_quit_early(struct diff_options *opt)
|
||||||
|
{
|
||||||
|
return (DIFF_OPT_TST(opt, QUICK) &&
|
||||||
|
!opt->filter &&
|
||||||
|
DIFF_OPT_TST(opt, HAS_CHANGES));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shall changes to this submodule be ignored?
|
* Shall changes to this submodule be ignored?
|
||||||
*
|
*
|
||||||
|
|
2
diff.h
2
diff.h
|
@ -198,6 +198,8 @@ extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_
|
||||||
|
|
||||||
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
|
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
|
||||||
|
|
||||||
|
extern int diff_can_quit_early(struct diff_options *);
|
||||||
|
|
||||||
extern void diff_addremove(struct diff_options *,
|
extern void diff_addremove(struct diff_options *,
|
||||||
int addremove,
|
int addremove,
|
||||||
unsigned mode,
|
unsigned mode,
|
||||||
|
|
|
@ -67,4 +67,9 @@ test_expect_success 'diff-files --diff-filter --quiet' '
|
||||||
test_must_fail git diff-files --diff-filter=M --quiet
|
test_must_fail git diff-files --diff-filter=M --quiet
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'diff-tree --diff-filter --quiet' '
|
||||||
|
git commit -a -m "worktree state" &&
|
||||||
|
test_must_fail git diff-tree --diff-filter=M --quiet HEAD^ HEAD
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -142,8 +142,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2,
|
||||||
strbuf_add(&base, base_str, baselen);
|
strbuf_add(&base, base_str, baselen);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (DIFF_OPT_TST(opt, QUICK) &&
|
if (diff_can_quit_early(opt))
|
||||||
DIFF_OPT_TST(opt, HAS_CHANGES))
|
|
||||||
break;
|
break;
|
||||||
if (opt->pathspec.nr) {
|
if (opt->pathspec.nr) {
|
||||||
skip_uninteresting(t1, &base, opt, &t1_match);
|
skip_uninteresting(t1, &base, opt, &t1_match);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче