(repo string, creds *auth.Credentials)
| 275 | } |
| 276 | |
| 277 | func (r Repo) listRemoteRefs(repo string, creds *auth.Credentials) ([]string, error) { |
| 278 | rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{ |
| 279 | Name: "origin", |
| 280 | URLs: []string{repo}, |
| 281 | }) |
| 282 | |
| 283 | refs, err := rem.List(&git.ListOptions{ |
| 284 | PeelingOption: git.AppendPeeled, |
| 285 | Auth: httpBasicAuthCredentials(creds), |
| 286 | }) |
| 287 | if err != nil { |
| 288 | return nil, errors.Wrap(err, fmt.Sprintf("repo %s was not cloned successfully; authentication might be required; check if repository exists and you referenced it correctly", repo)) |
| 289 | } |
| 290 | |
| 291 | branches := make([]string, 0) |
| 292 | |
| 293 | for _, ref := range refs { |
| 294 | if ref.Name().IsBranch() { |
| 295 | branches = append(branches, ref.Name().Short()) |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | return branches, nil |
| 300 | } |
| 301 | |
| 302 | func resolveRef(repo, version string, creds *auth.Credentials) (string, error) { |
| 303 | if len(version) == 0 { |
no test coverage detected