lib/octopolo/scripts/new_branch.rb in octopolo-1.2.1 vs lib/octopolo/scripts/new_branch.rb in octopolo-1.3.0
- old
+ new
@@ -4,10 +4,11 @@
module Octopolo
module Scripts
class NewBranch
include ConfigWrapper
include GitWrapper
+ include CLIWrapper
attr_accessor :new_branch_name
attr_accessor :source_branch_name
def self.execute(new_branch_name=nil, source_branch_name=nil)
@@ -20,10 +21,16 @@
end
# Public: Perform the script
def execute
raise ArgumentError unless new_branch_name
- git.new_branch(new_branch_name, source_branch_name)
+ if !git.reserved_branch?(new_branch_name) || cli.ask_boolean(Git::RESERVED_BRANCH_CONFIRM_MESSAGE)
+ git.new_branch(new_branch_name, source_branch_name)
+ else
+ message = Git::RESERVED_BRANCH_MESSAGE
+ git.alert_reserved_branch message
+ exit 1
+ end
end
# Public: Provide a default value if none is given
def default_source_branch_name
config.deploy_branch