Skip to content

Commit

Permalink
Merge pull request cli#1371 from cli/ignore-nondotcom-remotes
Browse files Browse the repository at this point in the history
Revert to ignoring non-github.com git remotes
  • Loading branch information
Nate Smith authored Jul 16, 2020
2 parents 4a2ff30 + f93261a commit 1f97a9a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,22 @@ func (c *fsContext) Remotes() (Remotes, error) {
}

sshTranslate := git.ParseSSHConfig().Translator()
c.remotes = translateRemotes(gitRemotes, sshTranslate)
resolvedRemotes := translateRemotes(gitRemotes, sshTranslate)

// ignore non-github.com remotes
// TODO: GHE compatibility
filteredRemotes := Remotes{}
for _, r := range resolvedRemotes {
if r.RepoHost() != defaultHostname {
continue
}
filteredRemotes = append(filteredRemotes, r)
}
c.remotes = filteredRemotes
}

if len(c.remotes) == 0 {
// TODO: GHE compatibility
return nil, errors.New("no git remote found for a github.com repository")
}
return c.remotes, nil
Expand Down

0 comments on commit 1f97a9a

Please sign in to comment.