Files
simplegit/gitcmd/download.go
T
2026-07-15 11:06:48 -04:00

28 lines
537 B
Go

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)
}