MCPcopy Create free account
hub / github.com/cloudflare/artifact-fs / fetchBatchToFile

Function fetchBatchToFile

internal/gitstore/gitstore.go:489–503  ·  view source on GitHub ↗
(ctx context.Context, batch *batchCatFile, objectOID string, dstPath string)

Source from the content-addressed store, hash-verified

487
488func 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:

Callers 1

BlobToCacheMethod · 0.85

Calls 2

fetchToFileMethod · 0.80
killMethod · 0.80

Tested by

no test coverage detected