Documentation
¶
Index ¶
- func ChangedPathsBetweenRefs(ctx context.Context, repoPath, leftRef, rightRef string) ([]string, error)
- func ChangedPathsFromRefToWorktree(ctx context.Context, repoPath, leftRef string) ([]string, error)
- func DefaultBranchNames(repoPath string) []string
- func RemoteURLs(repoPath string) []string
- func WorktreePathsMatchRevision(ctx context.Context, input PathDigestInput) (bool, error)
- type PathDigestInput
- type PathDigestPath
- type PathDigestResult
- type Request
- type Result
- type WorktreeChangeSetResult
- type WorktreeState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangedPathsBetweenRefs ¶
func DefaultBranchNames ¶ added in v0.2.5
DefaultBranchNames returns the branch name each remote's HEAD symref points at (refs/remotes/<remote>/HEAD -> refs/remotes/<remote>/<branch>) for the repository at repoPath. A clone sets origin/HEAD to the remote's default branch; CI checkouts often do not (pr-action's fetch-base records the pull request's base branch there via "git remote set-head origin <base>"). Any error returns nil: default-branch gating silently opts out. Read-only.
func RemoteURLs ¶ added in v0.2.5
RemoteURLs returns every fetch URL of every configured remote (all remotes, not just origin — fork/upstream layouts) of the repository at repoPath. Any error (non-git dir) returns nil: self-mapping silently opts out. Read-only: Remotes() never mutates the checkout.
func WorktreePathsMatchRevision ¶ added in v0.2.0
func WorktreePathsMatchRevision(ctx context.Context, input PathDigestInput) (bool, error)
WorktreePathsMatchRevision reports whether the worktree content of every requested repository-relative path matches the committed content at Revision: identical tracked file content under each path and no extra worktree files inside requested directories. Symlinks, submodules, and other unsupported modes fail closed (false). Errors mean the comparison could not be completed; callers must treat that as a mismatch.
Types ¶
type PathDigestInput ¶ added in v0.2.0
type PathDigestInput struct {
RepoPath string
Revision string
Paths []PathDigestPath
}
type PathDigestPath ¶ added in v0.2.0
type PathDigestResult ¶ added in v0.2.0
func CommittedPathDigest ¶ added in v0.2.0
func CommittedPathDigest(ctx context.Context, input PathDigestInput) (PathDigestResult, error)
CommittedPathDigest returns a stable digest for repository-relative paths in a committed Git tree. It reads Git object identity only, not worktree files.
type WorktreeChangeSetResult ¶ added in v0.2.0
type WorktreeChangeSetResult struct {
State WorktreeState
Revision string
DirtyPaths []string
}
WorktreeChangeSetResult holds the complete dirty-path enumeration for a worktree. DirtyPaths lists every repository-relative path whose worktree state differs from HEAD: modified, deleted, mode-flipped, or type-changed tracked files, plus every extra file (untracked, ignored, and files under untracked directories). A nested .git directory is recorded as a single dirty path without descending into it. Sorted, deduplicated, and empty exactly when State is clean. Completeness is load-bearing: per-path-set cache keying serves committed-key hits for path sets that no dirty path touches, so a missed category here would become a stale cache hit.
func WorktreeChangeSet ¶ added in v0.2.0
func WorktreeChangeSet(ctx context.Context, repoPath string) (WorktreeChangeSetResult, error)
WorktreeChangeSet classifies repoPath and enumerates every dirty path. It cannot short-circuit at the first difference because callers need the full set. Non-repository roots report unknown without failing.
type WorktreeState ¶ added in v0.2.0
type WorktreeState string
WorktreeState classifies the worktree relative to HEAD.
const ( WorktreeStateClean WorktreeState = "clean" WorktreeStateDirty WorktreeState = "dirty" WorktreeStateUnknown WorktreeState = "unknown" )