From 0227b93409ea361e360c9a44095d937d73f4e19c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 18 Mar 2020 23:26:02 +1100 Subject: [PATCH] fix branch parser --- pkg/commands/branch_list_builder.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/commands/branch_list_builder.go b/pkg/commands/branch_list_builder.go index 553d2f1f9..89b28d030 100644 --- a/pkg/commands/branch_list_builder.go +++ b/pkg/commands/branch_list_builder.go @@ -51,8 +51,11 @@ func (b *BranchListBuilder) obtainBranches() []*Branch { trimmedOutput := strings.TrimSpace(output) outputLines := strings.Split(trimmedOutput, "\n") - branches := make([]*Branch, len(outputLines)) - for i, line := range outputLines { + if len(outputLines) <= 1 { + return []*Branch{} + } + branches := make([]*Branch, len(outputLines)-1) + for i, line := range outputLines[1:] { split := strings.Split(line, SEPARATION_CHAR) name := split[0]