Commit 0261a26e authored by Douwe Maan's avatar Douwe Maan

Merge branch 'feature/fetch-remote-forced' into 'master'

Added an optional --force parameter for gitlab-projects fetch-remote

The optional parameter will decide wheter to fetch using --force or not.
fetching with --force is a requirement for Gitlab Geo (https://gitlab.com/gitlab-org/gitlab-ee/issues/76) secondary node
replication.

This is a dependency for https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/179

See merge request !41
parents ff31080b b4537bf0
...@@ -60,7 +60,7 @@ class GitlabProjects ...@@ -60,7 +60,7 @@ class GitlabProjects
when 'import-project'; import_project when 'import-project'; import_project
when 'fork-project'; fork_project when 'fork-project'; fork_project
when 'fetch-remote'; fetch_remote when 'fetch-remote'; fetch_remote
when 'update-head'; update_head when 'update-head'; update_head
when 'gc'; gc when 'gc'; gc
else else
$logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}." $logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}."
...@@ -135,8 +135,13 @@ class GitlabProjects ...@@ -135,8 +135,13 @@ class GitlabProjects
# timeout for fetch # timeout for fetch
timeout = (ARGV.shift || 120).to_i timeout = (ARGV.shift || 120).to_i
# fetch with --force ?
forced = (ARGV.shift == '--force')
$logger.info "Fetching remote #{@name} for project #{@project_name}." $logger.info "Fetching remote #{@name} for project #{@project_name}."
cmd = %W(git --git-dir=#{full_path} fetch #{@name} --tags) cmd = %W(git --git-dir=#{full_path} fetch #{@name} --tags)
cmd << '--force' if forced
pid = Process.spawn(*cmd) pid = Process.spawn(*cmd)
begin begin
......
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