Skip to content

Commit

Permalink
Merge pull request #288 from voxpupuli/execute-on-default-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored Jun 22, 2024
2 parents f52b2c1 + ecd1b4f commit 2d8a214
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/modulesync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 5 additions & 0 deletions lib/modulesync/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2d8a214

Please sign in to comment.