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

Function mergeProcessInput

commands/command_merge_driver.go:103–136  ·  view source on GitHub ↗
(gf *lfs.GitFilter, filename string, fileSpecifiers map[string]string, tag string)

Source from the content-addressed store, hash-verified

101}
102
103func mergeProcessInput(gf *lfs.GitFilter, filename string, fileSpecifiers map[string]string, tag string) {
104 file, err := lfs.TempFile(cfg, fmt.Sprintf("merge-driver-%s", tag))
105 if err != nil {
106 Exit(tr.Tr.Get("could not create temporary file when merging: %s", err))
107 }
108 defer file.Close()
109 fileSpecifiers[tag] = file.Name()
110
111 if len(filename) == 0 {
112 return
113 }
114
115 pointer, err := lfs.DecodePointerFromFile(filename)
116 if err != nil {
117 if errors.IsNotAPointerError(err) {
118 file.Close()
119 if err := lfs.CopyFileContents(cfg, filename, file.Name()); err != nil {
120 os.Remove(file.Name())
121 Exit(tr.Tr.Get("could not copy non-LFS content when merging: %s", err))
122 }
123 return
124 } else {
125 os.Remove(file.Name())
126 Exit(tr.Tr.Get("could not decode pointer when merging: %s", err))
127 }
128 }
129 cb, fp, err := gf.CopyCallbackFile("download", file.Name(), 1, 1)
130 if err != nil {
131 os.Remove(file.Name())
132 Exit(tr.Tr.Get("could not create callback: %s", err))
133 }
134 defer fp.Close()
135 _, err = gf.Smudge(file, pointer, file.Name(), true, getTransferManifestOperationRemote("download", cfg.Remote()), cb)
136}
137
138func init() {
139 RegisterCommand("merge-driver", mergeDriverCommand, func(cmd *cobra.Command) {

Callers 1

mergeDriverCommandFunction · 0.85

Calls 13

TempFileFunction · 0.92
DecodePointerFromFileFunction · 0.92
IsNotAPointerErrorFunction · 0.92
CopyFileContentsFunction · 0.92
ExitFunction · 0.85
CopyCallbackFileMethod · 0.80
SmudgeMethod · 0.80
GetMethod · 0.65
CloseMethod · 0.65
NameMethod · 0.65
RemoteMethod · 0.65

Tested by

no test coverage detected