Merge pull request #123 from paxan/dont-die-when-head-is-detached
Don't panic if your HEAD is detached
This commit is contained in:
commit
1df99f2bc6
1 changed files with 6 additions and 4 deletions
10
script/boxen
10
script/boxen
|
@ -39,10 +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'
|
||||||
|
|
||||||
short_branch = current_branch.split('/')[2..-1].join('/')
|
if current_branch.empty?
|
||||||
|
ref = `git log -1 --pretty=format:%h`
|
||||||
if !master
|
warn "Boxen not currently on any branch (ref: #{ref}), won't auto-update!"
|
||||||
warn "Boxen on a non-master branch '#{short_branch}', won't auto-update!"
|
elsif !master
|
||||||
|
local_branch = current_branch.split('/')[2..-1].join('/')
|
||||||
|
warn "Boxen on a non-master branch '#{local_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
|
||||||
|
|
Loading…
Reference in a new issue