Permalink
Browse files

If Github is down, `gitc qa` can accidentally merge into master. This…

… is not good.
  • Loading branch information...
1 parent 0e16128 commit 9c07a39639dae1a532b80c061f342ed3cd4c6c11 @winton committed May 2, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 lib/gitcycle.rb
View
@@ -550,12 +550,12 @@ def checkout_remote_branch(options={})
if branches(:match => target)
if yes?("You already have a branch called '#{target}'. Overwrite?")
- run("git push origin :#{target} -q")
- run("git checkout master -q")
- run("git branch -D #{target}")
+ run_safe("git push origin :#{target} -q")
+ run_safe("git checkout master -q")
+ run_safe("git branch -D #{target}")
else
- run("git checkout #{target} -q")
- run("git pull origin #{target} -q")
+ run_safe("git checkout #{target} -q")
+ run_safe("git pull origin #{target} -q")
return
end
end
@@ -859,6 +859,14 @@ def run(cmd)
end
end
+ def run_safe(cmd)
+ run(cmd)
+ if $? != 0
+ puts "The last command was supposed to run without error, but it didn't :(\n".red
+ puts "Please copy this session's output and send it to to gitcycle@bleacherreport.com.\n".yellow
+ end
+ end
+
def yes?(question)
q(question, " (#{"y".green}/#{"n".red})").downcase[0..0] == 'y'
end

0 comments on commit 9c07a39

Please sign in to comment.