Skip to content

Commit

Permalink
Fix 2-dot direct compare to use the right base commit (#24133) (#24150)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
GiteaBot and jtran authored Apr 16, 2023
1 parent 10f9399 commit 494e373
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 494e373

Please sign in to comment.