diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-05 13:44:24 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-05 13:44:24 +0300 |
commit | 4dd0c55f059154a8d866a16e4753212895061024 (patch) | |
tree | 08cc694334de51c74a38bbd57533c8f03af95eeb /lib/gitlab | |
parent | 5e1fc61986d96245ccbc36812441a1ad1cf062a1 (diff) | |
parent | 0ba0f9de08eb3d5113f4557b925506167484950a (diff) |
Merge branch 'fix/prepare-rebase-to-be-migrated-to-gitaly' into 'master'
Prepare Gitlab::Git::Repository#rebase for Gitaly migration
See merge request gitlab-org/gitlab-ce!16192
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/git/operation_service.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/git/operation_service.rb b/lib/gitlab/git/operation_service.rb index ef5bdbaf819..3fb0e2eed93 100644 --- a/lib/gitlab/git/operation_service.rb +++ b/lib/gitlab/git/operation_service.rb @@ -97,6 +97,11 @@ module Gitlab end end + def update_branch(branch_name, newrev, oldrev) + ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name + update_ref_in_hooks(ref, newrev, oldrev) + end + private # Returns [newrev, should_run_after_create, should_run_after_create_branch] diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index aec85f971ca..17c05c44d7e 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1219,9 +1219,16 @@ module Gitlab rebase_path = worktree_path(REBASE_WORKTREE_PREFIX, rebase_id) env = git_env_for_user(user) + if remote_repository.is_a?(RemoteRepository) + env.merge!(remote_repository.fetch_env) + remote_repo_path = GITALY_INTERNAL_URL + else + remote_repo_path = remote_repository.path + end + with_worktree(rebase_path, branch, env: env) do run_git!( - %W(pull --rebase #{remote_repository.path} #{remote_branch}), + %W(pull --rebase #{remote_repo_path} #{remote_branch}), chdir: rebase_path, env: env ) |