diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-10 01:48:43 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-10 01:48:43 +0200 |
commit | 6f1d1e00a7c615209cf6b25e314d033bda3b5d09 (patch) | |
tree | 51492dae8b010a25a2116e5c8cbeadeef1fa3726 /remote.go | |
parent | e013b297b14949aadaec66deaedc130e86c30afb (diff) | |
download | go-git-6f1d1e00a7c615209cf6b25e314d033bda3b5d09.tar.gz |
storage: filesystem ref storage, and not not exists file handling
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -161,9 +161,20 @@ func (r *Remote) buildRequest( } func (r *Remote) updateObjectStorage(reader io.Reader) error { - stream := packfile.NewScannerFromReader(reader) + s := r.s.ObjectStorage() + if sw, ok := s.(core.ObjectStorageWrite); ok { + w, err := sw.Writer() + if err != nil { + return err + } + + defer w.Close() + _, err = io.Copy(w, reader) + return err + } - d := packfile.NewDecoder(stream, r.s.ObjectStorage()) + stream := packfile.NewScannerFromReader(reader) + d := packfile.NewDecoder(stream, s) _, err := d.Decode() return err } |