Skip to content

Commit 1af3dc6

Browse files
authored
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.
1 parent fa34951 commit 1af3dc6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

routers/web/repo/compare.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,11 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
551551
ctx.ServerError("GetCompareInfo", err)
552552
return nil
553553
}
554-
ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase
554+
if ci.DirectComparison {
555+
ctx.Data["BeforeCommitID"] = ci.CompareInfo.BaseCommitID
556+
} else {
557+
ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase
558+
}
555559

556560
return ci
557561
}

0 commit comments

Comments
 (0)