Skip to content

Commit 36c8ce7

Browse files
committed
Some improvements
1 parent f75b87d commit 36c8ce7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

routers/web/repo/compare.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,13 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
221221
} else {
222222
infos = strings.SplitN(infoPath, "...", 2)
223223
if len(infos) != 2 {
224-
infos = []string{baseRepo.DefaultBranch, infoPath}
225-
if strings.Contains(infoPath, "..") {
226-
infos = strings.SplitN(infoPath, "..", 2)
224+
if infos = strings.SplitN(infoPath, "..", 2); len(infos) == 2 {
227225
ci.DirectComparison = true
228226
ctx.Data["PageIsComparePull"] = false
227+
} else {
228+
infos = []string{baseRepo.DefaultBranch, infoPath}
229229
}
230230
}
231-
232-
if len(infos) != 2 {
233-
log.Trace("ParseCompareInfo[%d]: not enough compared branches information %s", baseRepo.ID, infos)
234-
ctx.NotFound("CompareAndPullRequest", nil)
235-
return nil
236-
}
237231
}
238232

239233
ctx.Data["BaseName"] = baseRepo.OwnerName

0 commit comments

Comments
 (0)