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

Method download

tq/ssh.go:188–210  ·  view source on GitHub ↗
(t *Transfer, workerNum int, cb ProgressCallback)

Source from the content-addressed store, hash-verified

186}
187
188func (a *SSHAdapter) download(t *Transfer, workerNum int, cb ProgressCallback) error {
189 rel, err := t.Rel("download")
190 if err != nil {
191 return err
192 }
193 if rel == nil {
194 return errors.New(tr.Tr.Get("No download action for object: %s", t.Oid))
195 }
196 // Reserve a temporary filename. We need to make sure nobody operates on the file simultaneously with us.
197 f, err := tools.TempFile(a.tempDir(), t.Oid, a.fs)
198 if err != nil {
199 return err
200 }
201 tmpName := f.Name()
202 defer func() {
203 if f != nil {
204 f.Close()
205 }
206 os.Remove(tmpName)
207 }()
208
209 return a.doDownload(t, workerNum, f, cb)
210}
211
212// doDownload starts a download. f is expected to be an existing file open in RW mode
213func (a *SSHAdapter) doDownload(t *Transfer, workerNum int, f *os.File, cb ProgressCallback) error {

Callers 1

DoTransferMethod · 0.95

Calls 9

tempDirMethod · 0.95
doDownloadMethod · 0.95
NewFunction · 0.92
TempFileFunction · 0.92
RelMethod · 0.80
GetMethod · 0.65
NameMethod · 0.65
CloseMethod · 0.65
RemoveMethod · 0.45

Tested by

no test coverage detected