code: func (t *Tree) Encode(o plumbing.EncodedObject) (err error) {
  	o.SetType(plumbing.TreeObject)
  	w, err := o.Writer()
  	if err != nil {
  		return err
  	}
  
  	defer ioutil.CheckClose(w, &err)
  	for _, entry := range t.Entries {
  		if _, err = fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name); err != nil {
  			return err
  		}
  
  		if _, err = w.Write([]byte{0x00}); err != nil {
  			return err
  		}
  
  		if _, err = w.Write([]byte(entry.Hash[:])); err != nil {
  			return err
  		}
  	}
  
  	return err
  }
docs: // Encode transforms a Tree into a plumbing.EncodedObject.