It's cleaner to have another case: "not on any branch".

This commit is contained in:
Pavel Repin 2013-03-05 13:57:03 -08:00
parent 549f113930
commit 9c3b169156

View file

@ -39,13 +39,12 @@ unless ENV["BOXEN_NO_PULL"] || ARGV.include?("--no-pull")
upstream_changes = `git rev-list --count master..origin/master`.chomp != '0' upstream_changes = `git rev-list --count master..origin/master`.chomp != '0'
fast_forwardable = `git rev-list --count origin/master..master`.chomp == '0' fast_forwardable = `git rev-list --count origin/master..master`.chomp == '0'
if !master if current_branch.empty?
short_branch = if current_branch.empty? ref = `git log -1 --pretty=format:%h`
`git log -1 --pretty=format:%h` warn "Boxen not currently on any branch (ref: #{ref}), won't auto-update!"
else elsif !master
current_branch.split('/')[2..-1].join('/') local_branch = current_branch.split('/')[2..-1].join('/')
end warn "Boxen on a non-master branch '#{local_branch}', won't auto-update!"
warn "Boxen on a non-master branch '#{short_branch}', won't auto-update!"
elsif !fast_forwardable elsif !fast_forwardable
warn "Boxen's master branch is out of sync, won't auto-update!" warn "Boxen's master branch is out of sync, won't auto-update!"
elsif !clean elsif !clean