Permalink
Browse files

Handle detached head in legit branches

  • Loading branch information...
1 parent ee3325d commit 684d7b745834eacf1d5d1889b0a6ea57251a885c Chris Rose committed Apr 9, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 legit/cli.py
View
@@ -441,8 +441,13 @@ def display_available_branches():
for branch in branches:
- marker = '*' if (branch.name == repo.head.ref.name) else ' '
- color = colored.green if (branch.name == repo.head.ref.name) else colored.yellow
+ try:
+ branch_is_selected = (branch.name == repo.head.ref.name)
+ except TypeError:
+ branch_is_selected = False
+
+ marker = '*' if branch_is_selected else ' '
+ color = colored.green if branch_is_selected else colored.yellow
pub = '(published)' if branch.is_published else '(unpublished)'
print columns(
@@ -520,4 +525,4 @@ def handle_abort(aborted):
hv='harvest',
har='harvest',
h='help'
-)
+)

0 comments on commit 684d7b7

Please sign in to comment.