(ctx context.Context, batch *batchCatFile, objectOID string, dstPath string)
| 487 | |
| 488 | func cloneExactRef(ctx context.Context, target string, safeURL string, env []string, ref string, depth int) error { |
| 489 | advertisement, err := runGitWithEnv(ctx, "", env, "ls-remote", safeURL, ref) |
| 490 | if err != nil { |
| 491 | return err |
| 492 | } |
| 493 | advertisedOID := "" |
| 494 | for line := range strings.SplitSeq(advertisement, "\n") { |
| 495 | fields := strings.Fields(line) |
| 496 | if len(fields) == 2 && fields[1] == ref { |
| 497 | advertisedOID = strings.ToLower(fields[0]) |
| 498 | break |
| 499 | } |
| 500 | } |
| 501 | if advertisedOID == "" { |
| 502 | return fmt.Errorf("source ref %s was not advertised by the remote", ref) |
| 503 | } |
| 504 | initArgs := []string{"init"} |
| 505 | switch len(advertisedOID) { |
| 506 | case 40: |
no test coverage detected