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

Function CloneFile

tools/util_linux.go:43–53  ·  view source on GitHub ↗
(writer io.Writer, reader io.Reader)

Source from the content-addressed store, hash-verified

41}
42
43func CloneFile(writer io.Writer, reader io.Reader) (bool, error) {
44 fdst, fdstFound := writer.(*os.File)
45 fsrc, fsrcFound := reader.(*os.File)
46 if fdstFound && fsrcFound {
47 if err := unix.IoctlFileClone(int(fdst.Fd()), int(fsrc.Fd())); err != nil {
48 return false, err
49 }
50 return true, nil
51 }
52 return false, nil
53}
54
55func CloneFileByPath(dst, src string) (bool, error) {
56 srcFile, err := os.Open(src)

Callers 6

TestMethodExistsFunction · 0.70
CheckCloneFileSupportedFunction · 0.70
CloneFileByPathFunction · 0.70
TestCloneFileFunction · 0.70
TestCloneFileFunction · 0.70
CopyWithCallbackFunction · 0.70

Calls 1

FdMethod · 0.65

Tested by 3

TestMethodExistsFunction · 0.56
TestCloneFileFunction · 0.56
TestCloneFileFunction · 0.56