lib/gitx/cli/nuke_command.rb in gitx-2.23.0 vs lib/gitx/cli/nuke_command.rb in gitx-2.23.1.ci.174.1

- old
+ new

@@ -7,11 +7,11 @@ class NukeCommand < BaseCommand desc 'nuke', 'nuke the specified aggregate branch and reset it to a known good state' method_option :destination, type: :string, aliases: '-d', desc: 'destination branch to reset to' def nuke(bad_branch) good_branch = options[:destination] || ask("What branch do you want to reset #{bad_branch} to? (default: #{bad_branch})") - good_branch = bad_branch if good_branch.length == 0 + good_branch = bad_branch if good_branch.empty? last_known_good_tag = current_build_tag(good_branch) return unless yes?("Reset #{bad_branch} to #{last_known_good_tag}? (y/n)", :green) assert_aggregate_branch!(bad_branch) return if migrations_need_to_be_reverted?(bad_branch, last_known_good_tag) @@ -45,10 +45,10 @@ !yes?("Are you sure you want to nuke #{bad_branch}? (y/n) ", :green) end def current_build_tag(branch) last_build_tag = build_tags_for_branch(branch).last - fail "No known good tag found for branch: #{branch}. Verify tag exists via `git tag -l 'build-#{branch}-*'`" unless last_build_tag + raise "No known good tag found for branch: #{branch}. Verify tag exists via `git tag -l 'build-#{branch}-*'`" unless last_build_tag last_build_tag end def build_tags_for_branch(branch) run_git_cmd 'fetch', '--tags'