From 494e373292962de34b7ea7efd3f4a8d2f27daa26 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 16 Apr 2023 07:17:13 -0400 Subject: [PATCH] Fix 2-dot direct compare to use the right base commit (#24133) (#24150) Backport #24133 by @jtran For 2-dot direct compare, we should use the base commit in the title and templates, as is used elsewhere, not the common ancestor which is used for 3-dot compare. I believe that this change should have been included in #22949. Co-authored-by: Jonathan Tran --- routers/web/repo/compare.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index f21611c634..f63693e72e 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -551,7 +551,11 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { ctx.ServerError("GetCompareInfo", err) return nil } - ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase + if ci.DirectComparison { + ctx.Data["BeforeCommitID"] = ci.CompareInfo.BaseCommitID + } else { + ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase + } return ci }