Documentation
¶
Index ¶
- Variables
- func CleanGitEnv(environment []string) []string
- func OwningRepository(dir string) string
- type CommandRunner
- type Commit
- type Git
- func (g *Git) ApplyPatch3Way(ctx context.Context, repo, patch string) (bool, error)
- func (g *Git) ArchiveHead(ctx context.Context, repo string, writer io.Writer) error
- func (g *Git) BranchDelete(ctx context.Context, repo, branch string) error
- func (g *Git) BranchExists(ctx context.Context, repo, branch string) (bool, error)
- func (g *Git) CaptureStagedPatch(ctx context.Context, worktree, baseSHA string) (string, error)
- func (g *Git) CommitAll(ctx context.Context, worktree, message string) (string, error)
- func (g *Git) CommitTree(ctx context.Context, worktree, expectedParent, treeSHA, message string) (string, error)
- func (g *Git) CountAhead(ctx context.Context, repo, baseSHA string) (int, error)
- func (g *Git) CurrentBranch(ctx context.Context, repo string) (string, error)
- func (g *Git) Diff(ctx context.Context, worktree, baseSHA string) (string, error)
- func (g *Git) DiffNumstat(ctx context.Context, worktree, baseSHA string) (int, int, []string, error)
- func (g *Git) DiffSnapshot(ctx context.Context, worktree, baseSHA string) (Snapshot, error)
- func (g *Git) DiffStaged(ctx context.Context, worktree, baseSHA string) (string, error)
- func (g *Git) DiffTree(ctx context.Context, worktree, baseSHA, treeSHA string) (string, error)
- func (g *Git) Exec(ctx context.Context, repo string, args ...string) error
- func (g *Git) HasCommits(ctx context.Context, repo string) bool
- func (g *Git) HasSubmodules(ctx context.Context, repo string) bool
- func (g *Git) HasTrackedChanges(ctx context.Context, repo string) (bool, error)
- func (g *Git) InsideWorkTree(ctx context.Context, dir string) bool
- func (g *Git) IsClean(ctx context.Context, repo string) (bool, error)
- func (g *Git) LogCommits(ctx context.Context, repo, rng string) ([]Commit, error)
- func (g *Git) LsFiles(ctx context.Context, repo string) ([]string, error)
- func (g *Git) MergeAbort(ctx context.Context, repo string) error
- func (g *Git) MergeFFOnly(ctx context.Context, repo, branch string) error
- func (g *Git) MergeNoFF(ctx context.Context, repo, branch string) error
- func (g *Git) Output(ctx context.Context, repo string, args ...string) (string, error)
- func (g *Git) OutputRaw(ctx context.Context, repo string, args ...string) (string, error)
- func (g *Git) ReadOnlyNumstat(ctx context.Context, worktree, baseSHA string) (int, int, []string, error)
- func (g *Git) ResetHard(ctx context.Context, repo, baseSHA string) error
- func (g *Git) ResetMixed(ctx context.Context, worktree string) error
- func (g *Git) RevParseGitDir(ctx context.Context, repo string) (string, error)
- func (g *Git) RevParseHead(ctx context.Context, repo string) (string, error)
- func (g *Git) StageAll(ctx context.Context, worktree string) error
- func (g *Git) StageTree(ctx context.Context, worktree string) (string, error)
- func (g *Git) StatusPorcelainZ(ctx context.Context, repo string) (string, error)
- func (g *Git) UpdateHeadCAS(ctx context.Context, repo, newSHA, expectedOldSHA string) error
- func (g *Git) UsesLFS(ctx context.Context, repo string) bool
- func (g *Git) Version() (string, error)
- func (g *Git) WorktreeAdd(ctx context.Context, repo, path, branch, baseSHA string) error
- func (g *Git) WorktreeAddOwnedBranch(ctx context.Context, repo, path, branch, baseSHA string) (bool, error)
- func (g *Git) WorktreeInfo(ctx context.Context, repo, path string) (WorktreeInfo, error)
- func (g *Git) WorktreeLock(ctx context.Context, repo, path string) error
- func (g *Git) WorktreePrune(ctx context.Context, repo string) error
- func (g *Git) WorktreeRemove(ctx context.Context, repo, path string) error
- func (g *Git) WorktreeUnlock(ctx context.Context, repo, path string) error
- type Snapshot
- type WorktreeInfo
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CleanGitEnv ¶
CleanGitEnv is the shared boundary for direct Git/gh integrations outside this package. It removes repository-location variables but preserves normal authentication and locale environment for the caller.
func OwningRepository ¶ added in v0.4.0
OwningRepository returns the checkout that stores `.git/jacu` runstate. A linked worktree's `.git` file points at `<repo>/.git/worktrees/<id>`; a normal checkout is returned unchanged.
Types ¶
type CommandRunner ¶
type Commit ¶
type Commit struct {
Hash string
AuthorName string
AuthorEmail string
CommitterName string
CommitterEmail string
Subject string
Body string
}
Commit is one parsed git-log record. Field order matches the %x1f format in LogCommits.
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
func NewWithRunner ¶
func NewWithRunner(bin string, runner CommandRunner) *Git
func (*Git) ApplyPatch3Way ¶
ApplyPatch3Way applies one agent patch and reports a content conflict as a value. Mechanical git failures remain errors so the caller can distinguish an expected fan-in collision from a broken repository or command.
func (*Git) ArchiveHead ¶
func (*Git) BranchDelete ¶
func (*Git) BranchExists ¶
func (*Git) CaptureStagedPatch ¶
CaptureStagedPatch stages every file before reading the binary patch. The staging step is part of the fan-in contract: without it, newly created files are not blobs in the shared object database and git apply --3way cannot reconstruct their ancestor.
func (*Git) CommitTree ¶
func (*Git) CountAhead ¶
func (*Git) CurrentBranch ¶ added in v0.4.0
func (*Git) DiffNumstat ¶
func (*Git) DiffSnapshot ¶
func (*Git) DiffStaged ¶
func (*Git) HasTrackedChanges ¶ added in v0.4.0
HasTrackedChanges ignores untracked files, which a merge neither consumes nor overwrites. The checkout that runs autonomy always carries untracked JACU state — `.jacu/autonomy-policy.json` among them — and IsClean would refuse every local merge because of it.
func (*Git) LogCommits ¶
func (*Git) MergeAbort ¶ added in v0.4.0
func (*Git) MergeFFOnly ¶ added in v0.4.0
func (*Git) ReadOnlyNumstat ¶
func (*Git) ResetHard ¶
ResetHard restores an owned fan-in target to its known base after a conflict. Fan-in callers must pass the run's authoritative base SHA.
func (*Git) RevParseGitDir ¶ added in v0.4.0
func (*Git) RevParseHead ¶
func (*Git) StatusPorcelainZ ¶ added in v0.4.0
func (*Git) UpdateHeadCAS ¶
func (*Git) WorktreeAdd ¶
func (*Git) WorktreeAddOwnedBranch ¶
func (g *Git) WorktreeAddOwnedBranch(ctx context.Context, repo, path, branch, baseSHA string) (bool, error)
WorktreeAddOwnedBranch atomically creates branch before attaching it to a worktree. The boolean reports whether this invocation created the branch, so callers can avoid deleting a branch owned by another invocation on failure.