diff options
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r-- | plumbing/object/tree.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go index d2265a8..25687b0 100644 --- a/plumbing/object/tree.go +++ b/plumbing/object/tree.go @@ -240,29 +240,21 @@ func (t *Tree) Encode(o plumbing.EncodedObject) error { return err } - var size int defer ioutil.CheckClose(w, &err) for _, entry := range t.Entries { - n, err := fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name) - if err != nil { + if _, err := fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name); err != nil { return err } - size += n - n, err = w.Write([]byte{0x00}) - if err != nil { + if _, err = w.Write([]byte{0x00}); err != nil { return err } - size += n - n, err = w.Write([]byte(entry.Hash[:])) - if err != nil { + if _, err = w.Write([]byte(entry.Hash[:])); err != nil { return err } - size += n } - o.SetSize(int64(size)) return err } |