Documentation
¶
Overview ¶
Package git runs git commands against a repository on disk.
Index ¶
- type RepoStatus
- type ShellExecutor
- func (e *ShellExecutor) ApplyPatch(ctx context.Context, patch io.Reader) error
- func (e *ShellExecutor) Commit(ctx context.Context, message string) error
- func (e *ShellExecutor) Diff(ctx context.Context, paths ...string) (string, error)
- func (e *ShellExecutor) DiffCached(ctx context.Context, paths ...string) (string, error)
- func (e *ShellExecutor) Reset(ctx context.Context) error
- func (e *ShellExecutor) ResetPaths(ctx context.Context, paths ...string) error
- func (e *ShellExecutor) Status(ctx context.Context) (*RepoStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoStatus ¶
type RepoStatus struct {
// StagedFiles lists files with staged changes.
StagedFiles []string
// UnstagedFiles lists files with unstaged changes.
UnstagedFiles []string
// UntrackedFiles lists untracked files.
UntrackedFiles []string
}
RepoStatus represents the current state of the repository.
type ShellExecutor ¶
type ShellExecutor struct {
// WorkDir is the working directory for git commands.
// If empty, uses current directory.
WorkDir string
}
ShellExecutor runs git operations by shelling out to the git binary.
func NewShellExecutor ¶
func NewShellExecutor(workDir string) *ShellExecutor
NewShellExecutor creates a new ShellExecutor.
func (*ShellExecutor) ApplyPatch ¶
ApplyPatch applies a patch to the staging area.
func (*ShellExecutor) Commit ¶
func (e *ShellExecutor) Commit(ctx context.Context, message string) error
Commit creates a commit with the given message.
func (*ShellExecutor) DiffCached ¶
DiffCached returns the unified diff for staged changes.
func (*ShellExecutor) Reset ¶
func (e *ShellExecutor) Reset(ctx context.Context) error
Reset unstages all staged changes.
func (*ShellExecutor) ResetPaths ¶
func (e *ShellExecutor) ResetPaths( ctx context.Context, paths ...string, ) error
ResetPaths unstages changes for the given paths in one git invocation, so a path git rejects leaves the index untouched rather than half-reset.
func (*ShellExecutor) Status ¶
func (e *ShellExecutor) Status(ctx context.Context) (*RepoStatus, error)
Status returns the current repository status.
Click to show internal directories.
Click to hide internal directories.