summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-10-23 14:16:10 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-10-24 14:31:52 -0300
commita64601b9298d4b79bfc5d4f782b4dcc79ff33b74 (patch)
treeffeffae342bff5a8de96922d35d90c151bac546b /app
parent00c15cc27c33dd387069fce5777beb29d01f55ac (diff)
downloadgitlab-ce-a64601b9298d4b79bfc5d4f782b4dcc79ff33b74.tar.gz
Move all rugged operation for ff_merge inside Gitlab::Gitgitaly-ff-merge-preparation
We also delete some unused code related to the aforementioned feature.
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(