Permalink
Browse files

Only delete branch if it exists.

  • Loading branch information...
Gabe Berke-Williams
Gabe Berke-Williams committed Oct 7, 2011
1 parent c27f13f commit f260e9e0569625b76ca43f87da5ff18ce7a47935
Showing with 4 additions and 4 deletions.
  1. +0 −2 features/kumade_executable.feature
  2. +4 −2 lib/kumade/git.rb
@@ -28,7 +28,6 @@ Feature: Kumade executable
git push -f pretend-staging deploy:master
==> Pushed deploy:master -> pretend-staging
==> Migrated pretend-staging
- git checkout master 2>/dev/null && git branch -D deploy
==> Deployed to: pretend-staging
"""
But the output should not contain "==> Packaged with Kumade::MorePackager"
@@ -59,7 +58,6 @@ Feature: Kumade executable
git push -f pretend-staging deploy:master
==> Pushed deploy:master -> pretend-staging
==> Migrated pretend-staging
- git checkout new_branch 2>/dev/null && git branch -D deploy
==> Deployed to: pretend-staging
"""
View
@@ -29,8 +29,10 @@ def create(branch)
end
def delete(branch_to_delete, branch_to_checkout)
- command_line = CommandLine.new("git checkout #{branch_to_checkout} 2>/dev/null && git branch -D #{branch_to_delete}")
- command_line.run_or_error("Failed to clean up #{branch_to_delete} branch")
+ if has_branch?(branch_to_delete)
+ command_line = CommandLine.new("git checkout #{branch_to_checkout} 2>/dev/null && git branch -D #{branch_to_delete}")
+ command_line.run_or_error("Failed to clean up #{branch_to_delete} branch")
+ end
end
def add_and_commit_all_assets_in(dir)

0 comments on commit f260e9e

Please sign in to comment.