From 7217efbf26d7ec757ac72fdadf247a932e56244a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=F6m?= Date: Thu, 18 May 2006 21:36:40 +0100 Subject: [PATCH] Don't die when there are no branches MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Karl Hasselström --- stgit/commands/branch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index c7561a8..2218bbb 100644 --- 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: -- 2.11.0