MCPcopy Index your code
hub / github.com/git-lfs/git-lfs / doUpload

Method doUpload

tq/ssh.go:311–337  ·  view source on GitHub ↗
(t *Transfer, workerNum int, f *os.File, cb ProgressCallback)

Source from the content-addressed store, hash-verified

309}
310
311func (a *SSHAdapter) doUpload(t *Transfer, workerNum int, f *os.File, cb ProgressCallback) (int, []string, []string, error) {
312 args := a.argumentsForTransfer(t, "upload")
313
314 // Ensure progress callbacks made while uploading
315 // Wrap callback to give name context
316 ccb := func(totalSize int64, readSoFar int64, readSinceLast int) error {
317 if cb != nil {
318 return cb(t.Name, totalSize, readSoFar, readSinceLast)
319 }
320 return nil
321 }
322
323 cbr := tools.NewFileBodyWithCallback(f, t.Size, ccb)
324
325 conn, err := a.transfer.Connection(workerNum)
326 if err != nil {
327 return 0, nil, nil, err
328 }
329 conn.Lock()
330 defer conn.Unlock()
331 defer cbr.Close()
332 err = conn.SendMessageWithData(fmt.Sprintf("put-object %s", t.Oid), args, cbr)
333 if err != nil {
334 return 0, nil, nil, err
335 }
336 return conn.ReadStatusWithLines()
337}
338
339// upload starts an upload.
340func (a *SSHAdapter) upload(t *Transfer, workerNum int, cb ProgressCallback) error {

Callers 1

uploadMethod · 0.95

Calls 8

argumentsForTransferMethod · 0.95
NewFileBodyWithCallbackFunction · 0.92
ConnectionMethod · 0.80
SendMessageWithDataMethod · 0.80
ReadStatusWithLinesMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected