diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-05-05 11:34:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-05 11:34:50 +0200 |
commit | ced875aec7bef9113e1c37b1b811a59e17dbd138 (patch) | |
tree | 3cf652b8cfa94e011d4d7b5addfd13945870cda8 /plumbing/object/tree.go | |
parent | e80cdbabb92a1ec35ffad536f52d3ff04b548fd1 (diff) | |
parent | 3713157d189a109bdccdb055200defb17297b6de (diff) | |
download | go-git-ced875aec7bef9113e1c37b1b811a59e17dbd138.tar.gz |
Merge pull request #375 from mcuadros/commit
worktree: Commit method implementation
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 } |