From eeeb932b718ed4764df544ce85888461fc1377fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sun, 1 Mar 2020 13:53:12 +0100 Subject: [PATCH] git: fix GetRemote to not break when there is no remotes --- repository/git.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repository/git.go b/repository/git.go index d4560805754e85ce27c67f49da2351f3bf48d65a..1eb3b8b58d42c180ee900b6cab6195be0fb3d6e7 100644 --- a/repository/git.go +++ b/repository/git.go @@ -197,9 +197,12 @@ func (repo *GitRepo) GetRemotes() (map[string]string, error) { remotes := make(map[string]string, len(lines)) for _, line := range lines { + if strings.TrimSpace(line) == "" { + continue + } elements := strings.Fields(line) if len(elements) != 3 { - return nil, fmt.Errorf("unexpected output format: %s", line) + return nil, fmt.Errorf("git remote: unexpected output format: %s", line) } remotes[elements[0]] = elements[1]