Documentation
¶
Overview ¶
Package gitutil provides minimal git helpers used by the Ralph loop: repo detection, working-tree dirtiness checks, and short status output.
Everything is implemented by shelling out to the `git` binary so we do not pick up a heavy dependency. All commands are run from a caller-supplied working directory.
Index ¶
- Variables
- func CommitAll(ctx context.Context, dir, message string) (string, error)
- func CreateTag(ctx context.Context, dir, tag, message string) error
- func DiffStat(ctx context.Context, dir string) (string, error)
- func IsClean(ctx context.Context, dir string) (bool, error)
- func IsRepo(ctx context.Context, dir string) (bool, error)
- func PorcelainStatus(ctx context.Context, dir string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrGitNotFound = errors.New("git binary not found on PATH")
ErrGitNotFound indicates the `git` binary could not be located on PATH.
var ErrNotARepo = errors.New("not a git repository")
ErrNotARepo indicates the working directory is not inside a git repository.
Functions ¶
func CommitAll ¶
CommitAll stages every change in dir and creates a commit with the given message. It returns the resulting commit's short SHA. ErrNotARepo is returned when dir is not inside a git repository. A clean working tree returns ("", nil) — there is nothing to commit.
func CreateTag ¶
CreateTag creates an annotated tag pointing at HEAD. It is a no-op when the tag already exists.
func DiffStat ¶
DiffStat returns the output of `git diff --stat HEAD` for dir, capturing both staged and unstaged changes. An empty string means no diff. The "Bytes" field on Result holds the byte count of the captured diff.
Types ¶
This section is empty.