summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-25 12:42:25 +0000
committerRémy Coutable <remy@rymai.me>2017-10-25 12:42:25 +0000
commit53ab16f6fff4c73960f3324ac71db2c1a18b7c35 (patch)
treee84f9f886620f0d9c0bba123dd2ac4b9875dd1fd /app
parente81d74b9253e4a9f48bad0071bf37075bb6a20c5 (diff)
parenta64601b9298d4b79bfc5d4f782b4dcc79ff33b74 (diff)
downloadgitlab-ce-53ab16f6fff4c73960f3324ac71db2c1a18b7c35.tar.gz
Merge branch 'gitaly-ff-merge-preparation' into 'master'
Move all rugged operation for ff_merge inside Gitlab::Git Closes gitaly#683 See merge request gitlab-org/gitlab-ce!15011
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 4324ea46aac..327dbd2ea18 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -862,22 +862,12 @@ class Repository
end
def ff_merge(user, source, target_branch, merge_request: nil)
- our_commit = rugged.branches[target_branch].target
- their_commit =
- if source.is_a?(Gitlab::Git::Commit)
- source.raw_commit
- else
- rugged.lookup(source)
- end
+ their_commit_id = commit(source)&.id
+ raise 'Invalid merge source' if their_commit_id.nil?
- raise 'Invalid merge target' if our_commit.nil?
- raise 'Invalid merge source' if their_commit.nil?
+ merge_request&.update(in_progress_merge_commit_sha: their_commit_id)
- with_branch(user, target_branch) do |start_commit|
- merge_request&.update(in_progress_merge_commit_sha: their_commit.oid)
-
- their_commit.oid
- end
+ with_cache_hooks { raw.ff_merge(user, their_commit_id, target_branch) }
end
def revert(