summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2016-03-03 01:17:05 -0300
committerGabriel Mazetto <brodock@gmail.com>2016-03-03 01:17:05 -0300
commit6d7ccca3310a7728b79e3717eeaf7cf1ae905b12 (patch)
tree0c47ee4f887f870ff882d91456c1bd64477ab78b
parentff31080b0d5b5e7c99bfe7738aaa2bb1fafe60fb (diff)
downloadgitlab-shell-feature/fetch-remote-forced.tar.gz
Added an optional --force parameter for gitlab-projects fetch-remotefeature/fetch-remote-forced
The optional parameter will decide wheter to fetch using --force or not. fetching with --force is a requirement for Gitlab Geo secondary node replication.
-rw-r--r--VERSION2
-rw-r--r--lib/gitlab_projects.rb7
2 files changed, 7 insertions, 2 deletions
diff --git a/VERSION b/VERSION
index a04abec..bc02b86 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.6.10
+2.6.11
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index c1d175a..4f26d45 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -60,7 +60,7 @@ class GitlabProjects
when 'import-project'; import_project
when 'fork-project'; fork_project
when 'fetch-remote'; fetch_remote
- when 'update-head'; update_head
+ when 'update-head'; update_head
when 'gc'; gc
else
$logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}."
@@ -135,8 +135,13 @@ class GitlabProjects
# timeout for fetch
timeout = (ARGV.shift || 120).to_i
+
+ # fetch with --force ?
+ forced = (ARGV.shift == '--force' || false)
+
$logger.info "Fetching remote #{@name} for project #{@project_name}."
cmd = %W(git --git-dir=#{full_path} fetch #{@name} --tags)
+ cmd << '--force' if forced
pid = Process.spawn(*cmd)
begin