Documentation
¶
Overview ¶
Package git implements loop.VCS by shelling out to git. It stages and commits the agent's changes and pushes the branch so a pull request can be opened against it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
// Bin is the git binary; defaults to "git".
Bin string
// Remote is the push remote; defaults to "origin".
Remote string
// AuthorName and AuthorEmail identify the committer. A GitHub Actions
// runner has no git identity configured, so a commit there fails with
// "Author identity unknown" unless one is supplied. They are passed per
// command rather than written to global config, so a run never mutates the
// machine it happens to be on.
AuthorName string
AuthorEmail string
// DryRun skips the push. The commit still happens, because it is local to a
// worktree that is thrown away, and committing is what makes the diff
// inspectable. Pushing is the first step that changes someone's repository.
DryRun bool
// ScratchPaths are worktree-relative paths of transient agent scratch (build
// and module caches the engine writes inside the worktree). They are removed
// before staging so they never land in a commit. Defaults to .gocache,
// .gopath, and .aixgo.
ScratchPaths []string
}
Git runs git commands in a working directory.
func (*Git) Commit ¶
Commit stages all changes except the excluded scratch paths and commits them. It returns committed=false, with no error, when nothing (outside the excluded paths) is staged. Excluding at add time means agent scratch such as a build cache never lands in the commit, and an otherwise no-op run is correctly reported as "nothing to commit" even if scratch files exist.
func (*Git) Sync ¶
Sync hard-resets dir to the remote tip of branch. It fetches the branch and resets the working tree to FETCH_HEAD, then removes untracked files. This is used before the fixer runs so it edits the pull request's actual pushed state, never a stale checkout a prior run left behind (a reused worktree). Working on a stale tree and pushing would revert the human's or another commit's changes, which is why this is a deliberate step rather than trusting the worktree.
func (*Git) WorkflowChanges ¶
WorkflowChanges lists the tracked or untracked paths under `.github/workflows/` that the working tree has changed. An empty result means nothing there changed. The paths are returned rather than a bool so an escalation can name the files that caused it, instead of asking the reader to take the agent's word for what it edited.