aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-04-09 07:26:38 -0400
committerUnknwon <u@gogs.io>2018-04-09 07:26:38 -0400
commit8b66c433c568e019d1bfbfcbd6d9858890c484ea (patch)
tree4ac484f77fd3e6bac4d613389782be8abfc828b7
parent3329bfa5b2dd1888abb0ad9d6e7b690475234c5b (diff)
models/pull: fix error on merge pull requests to non-default branch (#5138)
-rw-r--r--gogs.go2
-rw-r--r--models/pull.go12
-rw-r--r--templates/.VERSION2
3 files changed, 5 insertions, 11 deletions
diff --git a/gogs.go b/gogs.go
index ac3b9d1f..472c2e53 100644
--- a/gogs.go
+++ b/gogs.go
@@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting"
)
-const APP_VER = "0.11.43.0330"
+const APP_VER = "0.11.44.0409"
func init() {
setting.AppVer = APP_VER
diff --git a/models/pull.go b/models/pull.go
index 18a770eb..de188c09 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -221,11 +221,12 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
os.MkdirAll(path.Dir(tmpBasePath), os.ModePerm)
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
if _, stderr, err = process.ExecTimeout(5*time.Minute,
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)
}
@@ -253,13 +254,6 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
switch mergeStyle {
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.
if _, stderr, err = process.ExecDir(-1, tmpBasePath,
fmt.Sprintf("PullRequest.Merge (git merge --no-ff --no-commit): %s", tmpBasePath),
diff --git a/templates/.VERSION b/templates/.VERSION
index 0ea95244..dc0b0c9d 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.11.43.0330 \ No newline at end of file
+0.11.44.0409 \ No newline at end of file