diff --git a/lib/modulesync.rb b/lib/modulesync.rb index 33dabbe..16e3baf 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -209,7 +209,11 @@ def self.execute(cli_options) $stdout.puts "#{puppet_module.given_name}:" puppet_module.repository.clone unless puppet_module.repository.cloned? - puppet_module.repository.switch branch: @options[:branch] + if @options[:default_branch] + puppet_module.repository.switch branch: false + else + puppet_module.repository.switch branch: @options[:branch] + end command_args = cli_options[:command_args] local_script = File.expand_path command_args[0] diff --git a/lib/modulesync/cli.rb b/lib/modulesync/cli.rb index b6ece1e..216a21b 100644 --- a/lib/modulesync/cli.rb +++ b/lib/modulesync/cli.rb @@ -175,6 +175,11 @@ def update aliases: '-b', desc: 'Branch name to make the changes in.', default: CLI.defaults[:branch] + option :default_branch, + aliases: '-B', + type: :boolean, + desc: 'Work on the default branch (take precedence over --branch).', + default: false option :fail_fast, type: :boolean, desc: 'Abort the run after a command execution failure',