]> source.dussan.org Git - gitea.git/commitdiff
Fix 2-dot direct compare to use the right base commit (#24133) (#24150)
authorGiteabot <teabot@gitea.io>
Sun, 16 Apr 2023 11:17:13 +0000 (07:17 -0400)
committerGitHub <noreply@github.com>
Sun, 16 Apr 2023 11:17:13 +0000 (13:17 +0200)
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 <jonnytran@gmail.com>
routers/web/repo/compare.go

index f21611c6348dde1ce6dc95b7f58340f5a2a43c06..f63693e72e45a2fcf8e31a083ce5e962c26ca99e 100644 (file)
@@ -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
 }