package gitcmd import ( "io" ) func (r *Repository) Patch(sha string) (string, error) { out, _, err := NewCommand("format-patch", "-1", "--stdout"). AddDynamicArguments(sha). WithDir(r.Path). RunStdString(r.ctx) return out, err } func (r *Repository) Archive(ref, format string, w io.Writer) error { if ref == "" { ref = "HEAD" } if format == "" { format = "zip" } return NewCommand("archive"). AddOptionValues("--format", format). AddDynamicArguments(ref). WithDir(r.Path). RunPiped(r.ctx, w, io.Discard) }