From 2f94bc3ecae26612a392f35e821db2976856e2cd Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Fri, 15 Sep 2017 10:17:14 +0100 Subject: Adds --force option to push branches. --- lib/gitlab_projects.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/gitlab_projects.rb') 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 -- cgit v1.2.1