aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/internal
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-11 20:35:06 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-11 20:35:06 +0200
commit58fe211f1b0e4863b425542d2fad15803276fd66 (patch)
treec200b6317b7b1c77c312faa411ab39e6e4468967 /storage/filesystem/internal
parent6f1d1e00a7c615209cf6b25e314d033bda3b5d09 (diff)
downloadgo-git-58fe211f1b0e4863b425542d2fad15803276fd66.tar.gz
format: packfile fix ReadObjectAt without decode
Diffstat (limited to 'storage/filesystem/internal')
-rw-r--r--storage/filesystem/internal/dotgit/dotgit.go13
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 {