diff options
author | Michael Muré <batolettre@gmail.com> | 2020-03-01 13:53:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-03-01 13:53:12 +0100 |
commit | eeeb932b718ed4764df544ce85888461fc1377fb (patch) | |
tree | fd014af4507e2d73669ddc39a50aba72e599b64d /repository | |
parent | 60bf8e0d6e8b0b7769f0eb34b2506f8e4adbe433 (diff) | |
download | git-bug-eeeb932b718ed4764df544ce85888461fc1377fb.tar.gz |
git: fix GetRemote to not break when there is no remotes
Diffstat (limited to 'repository')
-rw-r--r-- | repository/git.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/repository/git.go b/repository/git.go index d4560805..1eb3b8b5 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] |