This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -205,9 +205,7 @@ func (s *ObjectStorage) encodedObjectSizeFromPackfile(h plumbing.Hash) (
205205 if ok {
206206 return obj .Size (), nil
207207 }
208- }
209-
210- if err != nil && err != plumbing .ErrObjectNotFound {
208+ } else if err != nil && err != plumbing .ErrObjectNotFound {
211209 return 0 , err
212210 }
213211
Original file line number Diff line number Diff line change @@ -107,6 +107,20 @@ func (s *FsSuite) TestGetSizeFromPackfile(c *C) {
107107 })
108108}
109109
110+ func (s * FsSuite ) TestGetSizeOfAllObjectFiles (c * C ) {
111+ fs := fixtures .ByTag (".git" ).One ().DotGit ()
112+ o := NewObjectStorage (dotgit .New (fs ), cache .NewObjectLRUDefault ())
113+
114+ // Get the size of `tree_walker.go`.
115+ err := o .ForEachObjectHash (func (h plumbing.Hash ) error {
116+ size , err := o .EncodedObjectSize (h )
117+ c .Assert (err , IsNil )
118+ c .Assert (size , Not (Equals ), int64 (0 ))
119+ return nil
120+ })
121+ c .Assert (err , IsNil )
122+ }
123+
110124func (s * FsSuite ) TestGetFromPackfileMultiplePackfiles (c * C ) {
111125 fs := fixtures .ByTag (".git" ).ByTag ("multi-packfile" ).One ().DotGit ()
112126 o := NewObjectStorage (dotgit .New (fs ), cache .NewObjectLRUDefault ())
You can’t perform that action at this time.
0 commit comments