Skip to content

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 16, 2021
1 parent f75b87d commit 36c8ce7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,13 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
} else {
infos = strings.SplitN(infoPath, "...", 2)
if len(infos) != 2 {
infos = []string{baseRepo.DefaultBranch, infoPath}
if strings.Contains(infoPath, "..") {
infos = strings.SplitN(infoPath, "..", 2)
if infos = strings.SplitN(infoPath, "..", 2); len(infos) == 2 {
ci.DirectComparison = true
ctx.Data["PageIsComparePull"] = false
} else {
infos = []string{baseRepo.DefaultBranch, infoPath}
}
}

if len(infos) != 2 {
log.Trace("ParseCompareInfo[%d]: not enough compared branches information %s", baseRepo.ID, infos)
ctx.NotFound("CompareAndPullRequest", nil)
return nil
}
}

ctx.Data["BaseName"] = baseRepo.OwnerName
Expand Down

0 comments on commit 36c8ce7

Please sign in to comment.