diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index c49eb762d8a66..92abe0ce25917 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 }