diff options
author | Jonathan Tran <jonnytran@gmail.com> | 2023-04-16 03:27:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-16 10:27:23 +0300 |
commit | 1af3dc6ee35b3c60e697bdb9160c03e6eb3700aa (patch) | |
tree | 09c2a19e113ae1160e6925ca3cf4b0968407ab1c /routers | |
parent | fa3495183bf12c2414e18a3d3454067663c7aaa9 (diff) | |
download | gitea-1af3dc6ee35b3c60e697bdb9160c03e6eb3700aa.tar.gz gitea-1af3dc6ee35b3c60e697bdb9160c03e6eb3700aa.zip |
Fix 2-dot direct compare to use the right base commit (#24133)
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.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/compare.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index c49eb762d8..92abe0ce25 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 } |