CE-EE parity for lib/gitlab/git/gitlab_projects.rb
This commit is contained in:
parent
a8f4f48e4a
commit
f87e702ece
1 changed files with 13 additions and 12 deletions
|
@ -61,22 +61,15 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_remote(name, timeout, force:, tags:, ssh_key: nil, known_hosts: nil, prune: true)
|
def fetch_remote(name, timeout, force:, tags:, ssh_key: nil, known_hosts: nil, prune: true)
|
||||||
tags_option = tags ? '--tags' : '--no-tags'
|
|
||||||
|
|
||||||
logger.info "Fetching remote #{name} for repository #{repository_absolute_path}."
|
logger.info "Fetching remote #{name} for repository #{repository_absolute_path}."
|
||||||
cmd = %W(#{Gitlab.config.git.bin_path} fetch #{name} --quiet)
|
cmd = fetch_remote_command(name, tags, prune, force)
|
||||||
cmd << '--prune' if prune
|
|
||||||
cmd << '--force' if force
|
|
||||||
cmd << tags_option
|
|
||||||
|
|
||||||
setup_ssh_auth(ssh_key, known_hosts) do |env|
|
setup_ssh_auth(ssh_key, known_hosts) do |env|
|
||||||
success = run_with_timeout(cmd, timeout, repository_absolute_path, env)
|
run_with_timeout(cmd, timeout, repository_absolute_path, env).tap do |success|
|
||||||
|
unless success
|
||||||
unless success
|
logger.error "Fetching remote #{name} for repository #{repository_absolute_path} failed."
|
||||||
logger.error "Fetching remote #{name} for repository #{repository_absolute_path} failed."
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
success
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -202,6 +195,14 @@ module Gitlab
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def fetch_remote_command(name, tags, prune, force)
|
||||||
|
%W(#{Gitlab.config.git.bin_path} fetch #{name} --quiet).tap do |cmd|
|
||||||
|
cmd << '--prune' if prune
|
||||||
|
cmd << '--force' if force
|
||||||
|
cmd << (tags ? '--tags' : '--no-tags')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def git_import_repository(source, timeout)
|
def git_import_repository(source, timeout)
|
||||||
# Skip import if repo already exists
|
# Skip import if repo already exists
|
||||||
return false if File.exist?(repository_absolute_path)
|
return false if File.exist?(repository_absolute_path)
|
||||||
|
|
Loading…
Reference in a new issue