summaryrefslogtreecommitdiff
path: root/lib/gitlab_projects.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2017-09-15 10:17:14 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-09-19 17:05:23 +0100
commit2f94bc3ecae26612a392f35e821db2976856e2cd (patch)
treef4fb290fb4eb78f712fc8258edf800e6ab49a25d /lib/gitlab_projects.rb
parent2b575a8d646aa0dc45db6b8a371c7f6648f2ad69 (diff)
downloadgitlab-shell-2f94bc3ecae26612a392f35e821db2976856e2cd.tar.gz
Adds --force option to push branches.add-force-push-option-to-push-branches
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r--lib/gitlab_projects.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 49a1d25..9586345 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -116,8 +116,13 @@ class GitlabProjects
# timeout for push
timeout = (ARGV.shift || 120).to_i
+ # push with --force?
+ forced = ARGV.delete('--force') if ARGV.include?('--force')
+
$logger.info "Pushing branches from #{full_path} to remote #{remote_name}: #{ARGV}"
- cmd = %W(git --git-dir=#{full_path} push -- #{remote_name}).concat(ARGV)
+ cmd = %W(git --git-dir=#{full_path} push)
+ cmd << forced if forced
+ cmd += %W(-- #{remote_name}).concat(ARGV)
pid = Process.spawn(*cmd)
begin