diff options
Diffstat (limited to 'storage/filesystem/internal/dotgit')
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go index 6f0f1a5..52b621c 100644 --- a/storage/filesystem/internal/dotgit/dotgit.go +++ b/storage/filesystem/internal/dotgit/dotgit.go @@ -162,8 +162,11 @@ func (d *DotGit) ObjectPacks() ([]plumbing.Hash, error) { n := f.Name() h := plumbing.NewHash(n[5 : len(n)-5]) //pack-(hash).pack + if h.IsZero() { + // Ignore files with badly-formatted names. + continue + } packs = append(packs, h) - } return packs, nil @@ -255,7 +258,12 @@ func (d *DotGit) ForEachObjectHash(fun func(plumbing.Hash) error) error { } for _, o := range d { - err = fun(plumbing.NewHash(base + o.Name())) + h := plumbing.NewHash(base + o.Name()) + if h.IsZero() { + // Ignore files with badly-formatted names. + continue + } + err = fun(h) if err != nil { return err } |