Browse Source

models/pull: fix error on merge pull requests to non-default branch (#5138)

pull/5159/head
Unknwon 7 years ago
parent
commit
8b66c433c5
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 12
      models/pull.go
  3. 2
      templates/.VERSION

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/setting"
) )
const APP_VER = "0.11.43.0330" const APP_VER = "0.11.44.0409"
func init() { func init() {
setting.AppVer = APP_VER setting.AppVer = APP_VER

12
models/pull.go

@ -221,11 +221,12 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
os.MkdirAll(path.Dir(tmpBasePath), os.ModePerm) os.MkdirAll(path.Dir(tmpBasePath), os.ModePerm)
defer os.RemoveAll(path.Dir(tmpBasePath)) defer os.RemoveAll(path.Dir(tmpBasePath))
// Clone the base repository to the defined temporary directory. // Clone the base repository to the defined temporary directory,
// and checks out to base branch directly.
var stderr string var stderr string
if _, stderr, err = process.ExecTimeout(5*time.Minute, if _, stderr, err = process.ExecTimeout(5*time.Minute,
fmt.Sprintf("PullRequest.Merge (git clone): %s", tmpBasePath), fmt.Sprintf("PullRequest.Merge (git clone): %s", tmpBasePath),
"git", "clone", baseGitRepo.Path, tmpBasePath); err != nil { "git", "clone", "-b", pr.BaseBranch, baseGitRepo.Path, tmpBasePath); err != nil {
return fmt.Errorf("git clone: %s", stderr) return fmt.Errorf("git clone: %s", stderr)
} }
@ -253,13 +254,6 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
switch mergeStyle { switch mergeStyle {
case MERGE_STYLE_REGULAR: // Create merge commit case MERGE_STYLE_REGULAR: // Create merge commit
// Check out the base branch to be operated on.
if _, stderr, err = process.ExecDir(-1, tmpBasePath,
fmt.Sprintf("PullRequest.Merge (git checkout): %s", tmpBasePath),
"git", "checkout", pr.BaseBranch); err != nil {
return fmt.Errorf("git checkout '%s': %s", pr.BaseBranch, stderr)
}
// Merge changes from head branch. // Merge changes from head branch.
if _, stderr, err = process.ExecDir(-1, tmpBasePath, if _, stderr, err = process.ExecDir(-1, tmpBasePath,
fmt.Sprintf("PullRequest.Merge (git merge --no-ff --no-commit): %s", tmpBasePath), fmt.Sprintf("PullRequest.Merge (git merge --no-ff --no-commit): %s", tmpBasePath),

2
templates/.VERSION

@ -1 +1 @@
0.11.43.0330 0.11.44.0409
Loading…
Cancel
Save