diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-11 20:35:06 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-11 20:35:06 +0200 |
commit | 58fe211f1b0e4863b425542d2fad15803276fd66 (patch) | |
tree | c200b6317b7b1c77c312faa411ab39e6e4468967 /storage/filesystem/internal | |
parent | 6f1d1e00a7c615209cf6b25e314d033bda3b5d09 (diff) | |
download | go-git-58fe211f1b0e4863b425542d2fad15803276fd66.tar.gz |
format: packfile fix ReadObjectAt without decode
Diffstat (limited to 'storage/filesystem/internal')
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit.go | 13 |
1 files changed, 11 insertions, 2 deletions
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 { |