mirror of
https://github.com/gogs/gogs.git
synced 2025-04-27 13:13:10 +00:00
Fix changed branch is not reflected when creating PR (#3604)
This commit is contained in:
parent
a2f2f7717a
commit
e43479d948
@ -3,7 +3,7 @@ Gogs - Go Git Service [
|

|
||||||
|
|
||||||
##### Current tip version: 0.9.120 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
##### Current tip version: [`.VERSION`](templates/.VERSION) (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
||||||
|
|
||||||
| Web | UI | Preview |
|
| Web | UI | Preview |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
2
gogs.go
2
gogs.go
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.9.120.0127"
|
const APP_VER = "0.9.121.0127"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
|
@ -300,37 +300,6 @@ func RepoAssignment(args ...bool) macaron.Handler {
|
|||||||
ctx.Data["BranchName"] = ctx.Repo.BranchName
|
ctx.Data["BranchName"] = ctx.Repo.BranchName
|
||||||
ctx.Data["CommitID"] = ctx.Repo.CommitID
|
ctx.Data["CommitID"] = ctx.Repo.CommitID
|
||||||
|
|
||||||
if repo.IsFork {
|
|
||||||
RetrieveBaseRepo(ctx, repo)
|
|
||||||
if ctx.Written() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// People who have push access or have fored repository can propose a new pull request.
|
|
||||||
if ctx.Repo.IsWriter() || (ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) {
|
|
||||||
// Pull request is allowed if this is a fork repository
|
|
||||||
// and base repository accepts pull requests.
|
|
||||||
if repo.BaseRepo != nil {
|
|
||||||
if repo.BaseRepo.AllowsPulls() {
|
|
||||||
ctx.Data["BaseRepo"] = repo.BaseRepo
|
|
||||||
ctx.Repo.PullRequest.BaseRepo = repo.BaseRepo
|
|
||||||
ctx.Repo.PullRequest.Allowed = true
|
|
||||||
ctx.Repo.PullRequest.HeadInfo = ctx.Repo.Owner.Name + ":" + ctx.Repo.BranchName
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Or, this is repository accepts pull requests between branches.
|
|
||||||
if repo.AllowsPulls() {
|
|
||||||
ctx.Data["BaseRepo"] = repo
|
|
||||||
ctx.Repo.PullRequest.BaseRepo = repo
|
|
||||||
ctx.Repo.PullRequest.Allowed = true
|
|
||||||
ctx.Repo.PullRequest.SameRepo = true
|
|
||||||
ctx.Repo.PullRequest.HeadInfo = ctx.Repo.BranchName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.Data["PullRequestCtx"] = ctx.Repo.PullRequest
|
|
||||||
|
|
||||||
if ctx.Query("go-get") == "1" {
|
if ctx.Query("go-get") == "1" {
|
||||||
ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
|
ctx.Data["GoGetImport"] = composeGoGetImport(owner.Name, repo.Name)
|
||||||
prefix := setting.AppUrl + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
|
prefix := setting.AppUrl + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
|
||||||
@ -443,6 +412,37 @@ func RepoRef() macaron.Handler {
|
|||||||
ctx.Data["IsViewTag"] = ctx.Repo.IsViewTag
|
ctx.Data["IsViewTag"] = ctx.Repo.IsViewTag
|
||||||
ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit
|
ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit
|
||||||
|
|
||||||
|
if ctx.Repo.Repository.IsFork {
|
||||||
|
RetrieveBaseRepo(ctx, ctx.Repo.Repository)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// People who have push access or have fored repository can propose a new pull request.
|
||||||
|
if ctx.Repo.IsWriter() || (ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) {
|
||||||
|
// Pull request is allowed if this is a fork repository
|
||||||
|
// and base repository accepts pull requests.
|
||||||
|
if ctx.Repo.Repository.BaseRepo != nil {
|
||||||
|
if ctx.Repo.Repository.BaseRepo.AllowsPulls() {
|
||||||
|
ctx.Data["BaseRepo"] = ctx.Repo.Repository.BaseRepo
|
||||||
|
ctx.Repo.PullRequest.BaseRepo = ctx.Repo.Repository.BaseRepo
|
||||||
|
ctx.Repo.PullRequest.Allowed = true
|
||||||
|
ctx.Repo.PullRequest.HeadInfo = ctx.Repo.Owner.Name + ":" + ctx.Repo.BranchName
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Or, this is repository accepts pull requests between branches.
|
||||||
|
if ctx.Repo.Repository.AllowsPulls() {
|
||||||
|
ctx.Data["BaseRepo"] = ctx.Repo.Repository
|
||||||
|
ctx.Repo.PullRequest.BaseRepo = ctx.Repo.Repository
|
||||||
|
ctx.Repo.PullRequest.Allowed = true
|
||||||
|
ctx.Repo.PullRequest.SameRepo = true
|
||||||
|
ctx.Repo.PullRequest.HeadInfo = ctx.Repo.BranchName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.Data["PullRequestCtx"] = ctx.Repo.PullRequest
|
||||||
|
|
||||||
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount()
|
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "CommitsCount", err)
|
ctx.Handle(500, "CommitsCount", err)
|
||||||
|
@ -1 +1 @@
|
|||||||
0.9.120.0127
|
0.9.121.0127
|
Loading…
x
Reference in New Issue
Block a user