Skip to content

Commit 58cbfed

Browse files
committed
handle partly aborted script runs by asking to delete or rename branch, also handles conflict with existing branches
1 parent 2dde068 commit 58cbfed

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Rakefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ namespace :travis do
250250
end
251251

252252
each_project_with_common_travis_build do |name|
253+
if system("git show-branch #{branch_name} > /dev/null 2> /dev/null")
254+
puts "Branch #{branch_name} already exists, delete? [Y/n] or rename new branch? [r[ename] <name>]"
255+
input = STDIN.gets.downcase
256+
if input =~ /^y/
257+
`git branch -D #{branch_name}`
258+
elsif input =~ /^r(?:ename)? (.*)$/
259+
branch_name = $1
260+
end
261+
end
253262
sh "git checkout -b #{branch_name}"
254263

255264
files.each do |file|

0 commit comments

Comments
 (0)