~mdw
/
stgit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d7fade4
)
Don't die when there are no branches
author
Karl Hasselström
<kha@treskal.com>
Thu, 18 May 2006 20:36:40 +0000
(21:36 +0100)
committer
Catalin Marinas
<catalin.marinas@gmail.com>
Thu, 18 May 2006 20:36:40 +0000
(21:36 +0100)
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/branch.py
patch
|
blob
|
blame
|
history
diff --git
a/stgit/commands/branch.py
b/stgit/commands/branch.py
index
c7561a8
..
2218bbb
100644
(file)
--- a/
stgit/commands/branch.py
+++ b/
stgit/commands/branch.py
@@
-174,11
+174,14
@@
def func(parser, options, args):
branches = os.listdir(os.path.join(basedir.get(), 'refs', 'heads'))
branches.sort()
- max_len = max([len(i) for i in branches])
- print 'Available branches:'
- for i in branches:
- __print_branch(i, max_len)
+ if branches:
+ print 'Available branches:'
+ max_len = max([len(i) for i in branches])
+ for i in branches:
+ __print_branch(i, max_len)
+ else:
+ print 'No branches'
return
elif options.protect: