aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-10 01:48:43 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-10 01:48:43 +0200
commit6f1d1e00a7c615209cf6b25e314d033bda3b5d09 (patch)
tree51492dae8b010a25a2116e5c8cbeadeef1fa3726 /remote.go
parente013b297b14949aadaec66deaedc130e86c30afb (diff)
downloadgo-git-6f1d1e00a7c615209cf6b25e314d033bda3b5d09.tar.gz
storage: filesystem ref storage, and not not exists file handling
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/remote.go b/remote.go
index bfa7bc9..c654422 100644
--- a/remote.go
+++ b/remote.go
@@ -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
}