aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gogits/git-module/repo_pull.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-06-05 00:10:53 -0400
committerUnknwon <u@gogs.io>2017-06-05 00:10:53 -0400
commit36d6450977e40d8ea994590e3c9fd60184fe93e4 (patch)
tree411da811a540a8e6709a770ce392b9d5c58b54a8 /vendor/github.com/gogits/git-module/repo_pull.go
parent02a576a6a0ce6522b7b6af70bc2eea2de3f534d6 (diff)
repo/pull: detect case when no merge base found (#4434)
Diffstat (limited to 'vendor/github.com/gogits/git-module/repo_pull.go')
-rw-r--r--vendor/github.com/gogits/git-module/repo_pull.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/vendor/github.com/gogits/git-module/repo_pull.go b/vendor/github.com/gogits/git-module/repo_pull.go
index 1b0c1cf4..76efa6f4 100644
--- a/vendor/github.com/gogits/git-module/repo_pull.go
+++ b/vendor/github.com/gogits/git-module/repo_pull.go
@@ -22,7 +22,13 @@ type PullRequestInfo struct {
// GetMergeBase checks and returns merge base of two branches.
func (repo *Repository) GetMergeBase(base, head string) (string, error) {
stdout, err := NewCommand("merge-base", base, head).RunInDir(repo.Path)
- return strings.TrimSpace(stdout), err
+ if err != nil {
+ if strings.HasSuffix(err.Error(), " 1") {
+ return "", ErrNoMergeBase{}
+ }
+ return "", err
+ }
+ return strings.TrimSpace(stdout), nil
}
// GetPullRequestInfo generates and returns pull request information
@@ -47,7 +53,7 @@ func (repo *Repository) GetPullRequestInfo(basePath, baseBranch, headBranch stri
prInfo := new(PullRequestInfo)
prInfo.MergeBase, err = repo.GetMergeBase(remoteBranch, headBranch)
if err != nil {
- return nil, fmt.Errorf("GetMergeBase: %v", err)
+ return nil, err
}
logs, err := NewCommand("log", prInfo.MergeBase+"..."+headBranch, _PRETTY_LOG_FORMAT).RunInDirBytes(repo.Path)