summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/operation_service.rb
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2017-11-10 14:45:23 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-11-10 14:45:23 +0000
commitde301d13bb4f6d61cdaebfe186be6012c2f2096d (patch)
tree30aa61a630e1b18f139dcdf05c933eb7012adf45 /lib/gitlab/git/operation_service.rb
parent65faebb95556809c5858347f1c24422505056827 (diff)
downloadgitlab-ce-de301d13bb4f6d61cdaebfe186be6012c2f2096d.tar.gz
Prepare Repository#fetch_source_branch for migration
Diffstat (limited to 'lib/gitlab/git/operation_service.rb')
-rw-r--r--lib/gitlab/git/operation_service.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/gitlab/git/operation_service.rb b/lib/gitlab/git/operation_service.rb
index ab94ba8a73a..e36d5410431 100644
--- a/lib/gitlab/git/operation_service.rb
+++ b/lib/gitlab/git/operation_service.rb
@@ -72,7 +72,7 @@ module Gitlab
# Whenever `start_branch_name` is passed, if `branch_name` doesn't exist,
# it would be created from `start_branch_name`.
- # If `start_project` is passed, and the branch doesn't exist,
+ # If `start_repository` is passed, and the branch doesn't exist,
# it would try to find the commits from it instead of current repository.
def with_branch(
branch_name,
@@ -80,15 +80,13 @@ module Gitlab
start_repository: repository,
&block)
- # Refactoring aid
- unless start_repository.is_a?(Gitlab::Git::Repository)
- raise "expected a Gitlab::Git::Repository, got #{start_repository}"
- end
+ Gitlab::Git.check_namespace!(start_repository)
+ start_repository = RemoteRepository.new(start_repository) unless start_repository.is_a?(RemoteRepository)
start_branch_name = nil if start_repository.empty_repo?
if start_branch_name && !start_repository.branch_exists?(start_branch_name)
- raise ArgumentError, "Cannot find branch #{start_branch_name} in #{start_repository.full_path}"
+ raise ArgumentError, "Cannot find branch #{start_branch_name} in #{start_repository.relative_path}"
end
update_branch_with_hooks(branch_name) do