diff options
| author | Junio C Hamano <gitster@pobox.com> | 2020-10-05 14:01:50 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-10-05 14:01:50 -0700 |
| commit | c01b041ef08580cfadc288d14068beec84e9a2d3 (patch) | |
| tree | 23dc2ebe730083c41501cc43cc22a284d7876fb1 /commit-reach.c | |
| parent | ab4691b67bc1a2cd8d9068fb03e3fbd6979247d6 (diff) | |
| parent | 8791bf18414a37205127e184c04cad53a43aeff1 (diff) | |
| download | git-c01b041ef08580cfadc288d14068beec84e9a2d3.tar.xz | |
Merge branch 'ds/in-merge-bases-many-optim-bug'
in_merge_bases_many(), a way to see if a commit is reachable from
any commit in a set of commits, was totally broken when the
commit-graph feature was in use, which has been corrected.
* ds/in-merge-bases-many-optim-bug:
commit-reach: fix in_merge_bases_many bug
Diffstat (limited to 'commit-reach.c')
| -rw-r--r-- | commit-reach.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/commit-reach.c b/commit-reach.c index efd5925cbb..50175b159e 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -321,7 +321,7 @@ int repo_in_merge_bases_many(struct repository *r, struct commit *commit, { struct commit_list *bases; int ret = 0, i; - uint32_t generation, min_generation = GENERATION_NUMBER_INFINITY; + uint32_t generation, max_generation = GENERATION_NUMBER_ZERO; if (repo_parse_commit(r, commit)) return ret; @@ -330,12 +330,12 @@ int repo_in_merge_bases_many(struct repository *r, struct commit *commit, return ret; generation = commit_graph_generation(reference[i]); - if (generation < min_generation) - min_generation = generation; + if (generation > max_generation) + max_generation = generation; } generation = commit_graph_generation(commit); - if (generation > min_generation) + if (generation > max_generation) return ret; bases = paint_down_to_common(r, commit, |
