From 3a0a9ec33bc37f006b7c242404f9a16c8092b4da Mon Sep 17 00:00:00 2001 From: mjarkk Date: Mon, 26 Jul 2021 11:07:42 +0200 Subject: [PATCH] branches check for split parts length --- pkg/commands/loading_branches.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/commands/loading_branches.go b/pkg/commands/loading_branches.go index 67ad1c89d..7565a9aee 100644 --- a/pkg/commands/loading_branches.go +++ b/pkg/commands/loading_branches.go @@ -52,6 +52,12 @@ func (b *BranchListBuilder) obtainBranches() []*models.Branch { } split := strings.Split(line, SEPARATION_CHAR) + if len(split) != 4 { + // Ignore line if it isn't separated into 4 parts + // This is probably a warning message, for more info see: + // https://github.com/jesseduffield/lazygit/issues/1385#issuecomment-885580439 + continue + } name := strings.TrimPrefix(split[1], "heads/") branch := &models.Branch{