mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 16:16:35 -05:00
parent
f48680888c
commit
d663cef2a5
1 changed files with 14 additions and 8 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -569,7 +570,19 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
|
||||||
// format: <base branch>...[<head repo>:]<head branch>
|
// format: <base branch>...[<head repo>:]<head branch>
|
||||||
// base<-head: master...head:feature
|
// base<-head: master...head:feature
|
||||||
// same repo: master...feature
|
// same repo: master...feature
|
||||||
infos := strings.Split(ctx.Params("*"), "...")
|
|
||||||
|
var (
|
||||||
|
headUser *models.User
|
||||||
|
headBranch string
|
||||||
|
isSameRepo bool
|
||||||
|
infoPath string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
infoPath, err = url.QueryUnescape(ctx.Params("*"))
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(404, "QueryUnescape", err)
|
||||||
|
}
|
||||||
|
infos := strings.Split(infoPath, "...")
|
||||||
if len(infos) != 2 {
|
if len(infos) != 2 {
|
||||||
log.Trace("ParseCompareInfo[%d]: not enough compared branches information %s", baseRepo.ID, infos)
|
log.Trace("ParseCompareInfo[%d]: not enough compared branches information %s", baseRepo.ID, infos)
|
||||||
ctx.Handle(404, "CompareAndPullRequest", nil)
|
ctx.Handle(404, "CompareAndPullRequest", nil)
|
||||||
|
@ -579,13 +592,6 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
|
||||||
baseBranch := infos[0]
|
baseBranch := infos[0]
|
||||||
ctx.Data["BaseBranch"] = baseBranch
|
ctx.Data["BaseBranch"] = baseBranch
|
||||||
|
|
||||||
var (
|
|
||||||
headUser *models.User
|
|
||||||
headBranch string
|
|
||||||
isSameRepo bool
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
// If there is no head repository, it means pull request between same repository.
|
// If there is no head repository, it means pull request between same repository.
|
||||||
headInfos := strings.Split(infos[1], ":")
|
headInfos := strings.Split(infos[1], ":")
|
||||||
if len(headInfos) == 1 {
|
if len(headInfos) == 1 {
|
||||||
|
|
Loading…
Reference in a new issue