MCPcopy
hub / github.com/git-lfs/git-lfs / LinkOrCopyFromReference

Function LinkOrCopyFromReference

lfs/lfs.go:111–130  ·  view source on GitHub ↗
(cfg *config.Configuration, oid string, size int64)

Source from the content-addressed store, hash-verified

109)
110
111func LinkOrCopyFromReference(cfg *config.Configuration, oid string, size int64) error {
112 if cfg.LFSObjectExists(oid, size) {
113 return nil
114 }
115 altMediafiles := cfg.Filesystem().ObjectReferencePaths(oid)
116 mediafile, err := cfg.Filesystem().ObjectPath(oid)
117 if err != nil {
118 return err
119 }
120 for _, altMediafile := range altMediafiles {
121 tracerx.Printf("altMediafile: %s", altMediafile)
122 if altMediafile != "" && tools.FileExistsOfSize(altMediafile, size) {
123 err = LinkOrCopy(cfg, altMediafile, mediafile)
124 if err == nil {
125 break
126 }
127 }
128 }
129 return err
130}

Callers 5

delayedSmudgeFunction · 0.92
smudgeFunction · 0.92
pointersToFetchFunction · 0.92
pullFunction · 0.92
SmudgeMethod · 0.85

Calls 6

FileExistsOfSizeFunction · 0.92
LinkOrCopyFunction · 0.85
LFSObjectExistsMethod · 0.80
ObjectReferencePathsMethod · 0.80
FilesystemMethod · 0.45
ObjectPathMethod · 0.45

Tested by

no test coverage detected