Commit 9c3b1691563b10fc4fdf788202da0c1e943830ee

Authored by Pavel Repin
1 parent 549f113930

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

Showing 1 changed file with 6 additions and 7 deletions Side-by-side Diff

... ... @@ -39,13 +39,12 @@
39 39 upstream_changes = `git rev-list --count master..origin/master`.chomp != '0'
40 40 fast_forwardable = `git rev-list --count origin/master..master`.chomp == '0'
41 41  
42   - if !master
43   - short_branch = if current_branch.empty?
44   - `git log -1 --pretty=format:%h`
45   - else
46   - current_branch.split('/')[2..-1].join('/')
47   - end
48   - warn "Boxen on a non-master branch '#{short_branch}', won't auto-update!"
  42 + if current_branch.empty?
  43 + ref = `git log -1 --pretty=format:%h`
  44 + warn "Boxen not currently on any branch (ref: #{ref}), won't auto-update!"
  45 + elsif !master
  46 + local_branch = current_branch.split('/')[2..-1].join('/')
  47 + warn "Boxen on a non-master branch '#{local_branch}', won't auto-update!"
49 48 elsif !fast_forwardable
50 49 warn "Boxen's master branch is out of sync, won't auto-update!"
51 50 elsif !clean