From: Junio C Hamano Date: Tue, 30 Jun 2026 19:59:15 +0000 (-0700) Subject: Merge branch 'kk/commit-reach-find-all-fix' into jch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f4a824c81d733beba908b3adec157d1cf13de7d;p=thirdparty%2Fgit.git Merge branch 'kk/commit-reach-find-all-fix' into jch The early-exit optimization in paint_down_to_common() has been gated on the queue being generation-ordered. This fixes a bug where git merge-base (without --all) could return incorrect results on repositories with v1 commit graphs and clock skew. * kk/commit-reach-find-all-fix: commit-reach: guard !FIND_ALL early exit with generation ordering check t6600: add test for merge-base early exit with clock skew --- 4f4a824c81d733beba908b3adec157d1cf13de7d diff --cc commit-reach.c index 5df471a313,ee4b7b6925..708798a39b --- a/commit-reach.c +++ b/commit-reach.c @@@ -104,15 -57,16 +104,18 @@@ static int paint_down_to_common(struct enum merge_base_flags mb_flags, struct commit_list **result) { - struct prio_queue queue = { compare_commits_by_gen_then_commit_date }; + struct nonstale_queue queue = { + { compare_commits_by_gen_then_commit_date } + }; int i; + int gen_ordered = 1; timestamp_t last_gen = GENERATION_NUMBER_INFINITY; struct commit_list **tail = result; - if (!min_generation && !corrected_commit_dates_enabled(r)) + if (!min_generation && !corrected_commit_dates_enabled(r)) { - queue.compare = compare_commits_by_commit_date; + queue.pq.compare = compare_commits_by_commit_date; + gen_ordered = 0; + } one->object.flags |= PARENT1; if (!n) {