Skip to content
Snippets Groups Projects
Unverified Commit eeeb932b authored by Michael Muré's avatar Michael Muré
Browse files

git: fix GetRemote to not break when there is no remotes

parent 60bf8e0d
No related branches found
No related tags found
No related merge requests found
...@@ -197,9 +197,12 @@ func (repo *GitRepo) GetRemotes() (map[string]string, error) { ...@@ -197,9 +197,12 @@ func (repo *GitRepo) GetRemotes() (map[string]string, error) {
remotes := make(map[string]string, len(lines)) remotes := make(map[string]string, len(lines))
for _, line := range lines { for _, line := range lines {
if strings.TrimSpace(line) == "" {
continue
}
elements := strings.Fields(line) elements := strings.Fields(line)
if len(elements) != 3 { 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] remotes[elements[0]] = elements[1]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment