Commit d0e5b349 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'update-branch-client-preparation' into 'master'

Move git calls for `Repository#update_branch` inside Gitlab::Git

Closes gitaly#1250

See merge request gitlab-org/gitlab-ee!6279
parents 87c7a959 5105469a
......@@ -35,12 +35,5 @@ module EE
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1243
::Gitlab::GitalyClient::StorageSettings.allow_disk_access { super }
end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1246
def update_branch(user, branch_name, newrev, oldrev)
::Gitlab::GitalyClient::StorageSettings.allow_disk_access do
::Gitlab::Git::OperationService.new(user, raw_repository).update_branch(branch_name, newrev, oldrev)
end
end
end
end
......@@ -97,7 +97,10 @@ module Projects
newrev = upstream.dereferenced_target.sha
oldrev = local.dereferenced_target.sha
repository.update_branch(current_user, branch_name, newrev, oldrev)
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1246
::Gitlab::GitalyClient::StorageSettings.allow_disk_access do
repository.update_branch(branch_name, user: current_user, newrev: newrev, oldrev: oldrev)
end
elsif branch_name == project.default_branch
# Cannot be updated
errors << "The default branch (#{project.default_branch}) has diverged from its upstream counterpart and could not be updated automatically."
......
......@@ -684,6 +684,10 @@ module Gitlab
end
end
def update_branch(branch_name, user:, newrev:, oldrev:)
OperationService.new(user, self).update_branch(branch_name, newrev, oldrev)
end
def rm_branch(branch_name, user:)
gitaly_migrate(:operation_user_delete_branch, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled
......@@ -1953,8 +1957,7 @@ module Gitlab
rebase_sha = run_git!(%w(rev-parse HEAD), chdir: rebase_path, env: env).strip
Gitlab::Git::OperationService.new(user, self)
.update_branch(branch, rebase_sha, branch_sha)
update_branch(branch, user: user, newrev: rebase_sha, oldrev: branch_sha)
rebase_sha
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment