From: Junio C Hamano Date: Sun, 19 Jul 2026 17:42:16 +0000 (-0700) Subject: Merge branch 'kk/commit-reach-find-all-fix' X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=1950f4628e3973847d447e51162f61e69748ea92;p=thirdparty%2Fgit.git Merge branch 'kk/commit-reach-find-all-fix' The early-exit optimization in 'paint_down_to_common()' has been gated on the queue being generation-ordered, fixing 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 --- 1950f4628e3973847d447e51162f61e69748ea92 diff --cc commit-reach.c index 3898d09dec,ee4b7b6925..d7221fe389 --- 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) {