(ctx context.Context, o *ListOptions)
| 1354 | } |
| 1355 | |
| 1356 | func (r *Remote) list(ctx context.Context, o *ListOptions) (rfs []*plumbing.Reference, err error) { |
| 1357 | if r.c == nil || len(r.c.URLs) == 0 { |
| 1358 | return nil, ErrEmptyUrls |
| 1359 | } |
| 1360 | |
| 1361 | s, err := newUploadPackSession(r.c.URLs[0], o.Auth, o.InsecureSkipTLS, o.ClientCert, o.ClientKey, o.CABundle, o.ProxyOptions) |
| 1362 | if err != nil { |
| 1363 | return nil, err |
| 1364 | } |
| 1365 | |
| 1366 | defer ioutil.CheckClose(s, &err) |
| 1367 | |
| 1368 | ar, err := s.AdvertisedReferencesContext(ctx) |
| 1369 | if err != nil { |
| 1370 | return nil, err |
| 1371 | } |
| 1372 | |
| 1373 | allRefs, err := ar.AllReferences() |
| 1374 | if err != nil { |
| 1375 | return nil, err |
| 1376 | } |
| 1377 | |
| 1378 | refs, err := allRefs.IterReferences() |
| 1379 | if err != nil { |
| 1380 | return nil, err |
| 1381 | } |
| 1382 | |
| 1383 | var resultRefs []*plumbing.Reference |
| 1384 | if o.PeelingOption == AppendPeeled || o.PeelingOption == IgnorePeeled { |
| 1385 | err = refs.ForEach(func(ref *plumbing.Reference) error { |
| 1386 | resultRefs = append(resultRefs, ref) |
| 1387 | return nil |
| 1388 | }) |
| 1389 | if err != nil { |
| 1390 | return nil, err |
| 1391 | } |
| 1392 | } |
| 1393 | |
| 1394 | if o.PeelingOption == AppendPeeled || o.PeelingOption == OnlyPeeled { |
| 1395 | for k, v := range ar.Peeled { |
| 1396 | resultRefs = append(resultRefs, plumbing.NewReferenceFromStrings(k+"^{}", v.String())) |
| 1397 | } |
| 1398 | } |
| 1399 | |
| 1400 | return resultRefs, nil |
| 1401 | } |
| 1402 | |
| 1403 | func objectsToPush(commands []*packp.Command) []plumbing.Hash { |
| 1404 | objects := make([]plumbing.Hash, 0, len(commands)) |
no test coverage detected