From 58fe211f1b0e4863b425542d2fad15803276fd66 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 11 Sep 2016 20:35:06 +0200 Subject: format: packfile fix ReadObjectAt without decode --- storage/filesystem/internal/dotgit/dotgit.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'storage/filesystem/internal/dotgit') diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go index e22ed58..cacda68 100644 --- a/storage/filesystem/internal/dotgit/dotgit.go +++ b/storage/filesystem/internal/dotgit/dotgit.go @@ -236,6 +236,7 @@ type PackWriter struct { checksum core.Hash index idxfile.Idxfile result chan error + Notify func(h core.Hash, i idxfile.Idxfile) } func newPackWrite(fs fs.Filesystem) (*PackWriter, error) { @@ -265,7 +266,7 @@ func newPackWrite(fs fs.Filesystem) (*PackWriter, error) { func (w *PackWriter) buildIndex() { defer w.sr.Close() o := memory.NewStorage().ObjectStorage() - s := packfile.NewScannerFromReader(w.sr) + s := packfile.NewScanner(w.sr) d := packfile.NewDecoder(s, o) checksum, err := d.Decode() @@ -307,7 +308,15 @@ func (w *PackWriter) Close() error { return err } - return w.save() + if err := w.save(); err != nil { + return err + } + + if w.Notify != nil { + w.Notify(w.checksum, w.index) + } + + return nil } func (w *PackWriter) save() error { -- cgit