aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/merge_upstream.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository/merge_upstream.go')
-rw-r--r--services/repository/merge_upstream.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/repository/merge_upstream.go b/services/repository/merge_upstream.go
index 34e01df723..8d6f11372c 100644
--- a/services/repository/merge_upstream.go
+++ b/services/repository/merge_upstream.go
@@ -18,7 +18,7 @@ import (
)
// MergeUpstream merges the base repository's default branch into the fork repository's current branch.
-func MergeUpstream(ctx reqctx.RequestContext, doer *user_model.User, repo *repo_model.Repository, branch string) (mergeStyle string, err error) {
+func MergeUpstream(ctx reqctx.RequestContext, doer *user_model.User, repo *repo_model.Repository, branch string, ffOnly bool) (mergeStyle string, err error) {
if err = repo.MustNotBeArchived(); err != nil {
return "", err
}
@@ -45,6 +45,11 @@ func MergeUpstream(ctx reqctx.RequestContext, doer *user_model.User, repo *repo_
return "", err
}
+ // If ff_only is requested and fast-forward failed, return error
+ if ffOnly {
+ return "", util.NewInvalidArgumentErrorf("fast-forward merge not possible: branch has diverged")
+ }
+
// TODO: FakePR: it is somewhat hacky, but it is the only way to "merge" at the moment
// ideally in the future the "merge" functions should be refactored to decouple from the PullRequest
fakeIssue := &issue_model.Issue{