aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree_test.go
diff options
context:
space:
mode:
authorJeremy Stribling <strib@alum.mit.edu>2018-10-11 16:28:19 -0700
committerJeremy Stribling <strib@alum.mit.edu>2018-10-11 17:12:29 -0700
commit5c471c34813577a420c1a5af61dd855f70badce1 (patch)
treee553ca7d22039ecbd0a7cc512ec7bb66ea422da3 /plumbing/object/tree_test.go
parent1e1315d5e587d481e73e295dd18e50026af48c79 (diff)
downloadgo-git-5c471c34813577a420c1a5af61dd855f70badce1.tar.gz
tree: add a Size() method for getting plaintext size
Without reading the entire object into memory. Signed-off-by: Jeremy Stribling <strib@alum.mit.edu>
Diffstat (limited to 'plumbing/object/tree_test.go')
-rw-r--r--plumbing/object/tree_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/object/tree_test.go b/plumbing/object/tree_test.go
index 7366421..889c63a 100644
--- a/plumbing/object/tree_test.go
+++ b/plumbing/object/tree_test.go
@@ -98,6 +98,12 @@ func (s *TreeSuite) TestFileFailsWithExistingTrees(c *C) {
c.Assert(err, Equals, ErrFileNotFound)
}
+func (s *TreeSuite) TestSize(c *C) {
+ size, err := s.Tree.Size("LICENSE")
+ c.Assert(err, IsNil)
+ c.Assert(size, Equals, int64(1072))
+}
+
func (s *TreeSuite) TestFiles(c *C) {
var count int
err := s.Tree.Files().ForEach(func(f *File) error {