Documentation
¶
Index ¶
- Constants
- Variables
- func BranchCheckoutKey(repositoryKey, branchID string) string
- func ContentHash(ctx context.Context, source Source, snapshots []review.RepositoryDiff) (string, error)
- func CurrentBranch(ctx context.Context, root string) (string, error)
- func DefaultBranch(ctx context.Context, root string) (string, error)
- func Error(status int, format string, values ...any) error
- func LocalBranches(ctx context.Context, root, base string) ([]string, error)
- func Message(value string) *string
- func PatchContext(patch, side string, start, end int) (string, bool)
- func PreviewUnavailable(err error) bool
- func RemoteRepositoryName(remote, fallback string) string
- func RepositoryIdentity(ctx context.Context, root string) (commonDir, worktreeDir string, err error)
- type Comparison
- type RepositoryMetadata
- type RequestError
- type Source
- type StableRepositoryIdentity
- type Support
- type Worktree
- type WorktreeChangeSummary
Constants ¶
const ( MaxInputBytes = 16 * 1024 * 1024 MaxFileBytes = 2 * 1024 * 1024 )
Variables ¶
ErrComparisonUnavailable permits replaying an already captured comparison after its local refs disappear. It never masks process or cancellation errors.
var ErrNoDefaultBranch = errors.New("no local default branch available for comparison")
ErrNoDefaultBranch means no existing local default branch can be resolved.
var ErrNotRepository = errors.New("not a Git working tree")
Functions ¶
func BranchCheckoutKey ¶
BranchCheckoutKey identifies an object-only branch source after its checkout disappears. It never depends on the surviving checkout's path or branch name.
func ContentHash ¶
func ContentHash(ctx context.Context, source Source, snapshots []review.RepositoryDiff) (string, error)
ContentHash identifies complete Git contents independently of filesystem timestamps and preview limits. An empty hash means complete identity cannot be proven, so callers must not deduplicate changed snapshots by content.
func CurrentBranch ¶
CurrentBranch returns the same branch label as a snapshot without reading checkout diffs or file contents.
func DefaultBranch ¶
DefaultBranch resolves existing local refs only. It never fetches or consults a feature branch's upstream, which may simply track that same feature branch.
func LocalBranches ¶
LocalBranches enumerates unmerged local branches with a finite result bound.
func PreviewUnavailable ¶
PreviewUnavailable distinguishes intentional preview limits from failures requiring collection to stop (including cancellation and concurrent edits).
func RemoteRepositoryName ¶
RemoteRepositoryName extracts the display name from URL and SCP-style remotes.
Types ¶
type Comparison ¶
type Comparison struct {
BaseRef string
BaseCommit string
BaseOID string
HeadOID string
ObjectsOnly bool
}
func ComparisonInfo ¶
func ComparisonInfo(source Source) (Comparison, bool)
ComparisonInfo reports the captured comparison, including its merge base. A false result denotes ordinary checkout collection against HEAD.
type RepositoryMetadata ¶
RepositoryMetadata contains checkout facts without collecting its diff.
type RequestError ¶
type RequestError = review.RequestError
type Source ¶
func OpenComparison ¶
OpenComparison captures a branch comparison without switching or creating a checkout. An empty branch reads the current checkout; a named branch reads immutable objects only, ignoring the current checkout's index and files.
type StableRepositoryIdentity ¶
StableRepositoryIdentity persists provenance independently of mutable labels.
func StableIdentity ¶
func StableIdentity(ctx context.Context, root, sourceID, branch string) (StableRepositoryIdentity, error)
StableIdentity adopts existing repository/checkout keys once, then preserves them through directory moves, remote changes, and Git branch renames. Copying Git metadata also copies identities; an independent clone has new metadata.
type WorktreeChangeSummary ¶
func WorktreeChanges ¶
func WorktreeChanges(ctx context.Context, root, gitDir string) (WorktreeChangeSummary, error)
WorktreeChanges reads local change counts and times without loading diffs.