lfs: only comnbine readers when necessary
This commit is contained in:
parent
e450c68901
commit
482eba2176
@ -82,8 +82,14 @@ func copyToTemp(reader io.Reader, fileSize int64, cb progress.CopyCallback) (oid
|
||||
return
|
||||
}
|
||||
|
||||
multi := io.MultiReader(bytes.NewReader(by), reader)
|
||||
size, err = tools.CopyWithCallback(writer, multi, fileSize, cb)
|
||||
var from io.Reader = bytes.NewReader(by)
|
||||
if int64(len(by)) < fileSize {
|
||||
// If there is still more data to be read from the file, tack on
|
||||
// the original reader and continue the read from there.
|
||||
from = io.MultiReader(from, reader)
|
||||
}
|
||||
|
||||
size, err = tools.CopyWithCallback(writer, from, fileSize, cb)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user