func (r *ReferenceUpdateRequest) Encode(w io.Writer) error {
	if err := r.validate(); err != nil {
		return err
	}
	e := pktline.NewEncoder(w)
	if err := r.encodeShallow(e, r.Shallow); err != nil {
		return err
	}
	if err := r.encodeCommands(e, r.Commands, r.Capabilities); err != nil {
		return err
	}
	if r.Packfile != nil {
		if _, err := io.Copy(w, r.Packfile); err != nil {
			return err
		}
		return r.Packfile.Close()
	}
	return nil
}
Encode writes the ReferenceUpdateRequest encoding to the stream.
package packp
import (
	"fmt"
	"io"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
	"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
)
var (
	zeroHashString = plumbing.ZeroHash.String()
)