Documentation
¶
Index ¶
- Constants
- Variables
- func ActivityTime(ctx context.Context, source Source, head *string, gitDir string) (int64, error)
- 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 DefaultBaselines(ctx context.Context, root string) ([]string, error)
- func Error(status int, format string, values ...any) 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 CommitRange
- type Comparison
- type RepositoryMetadata
- type RequestError
- type Source
- func CommitSource(ctx context.Context, source Source, commit review.Commit) (Source, error)
- func OpenComparison(ctx context.Context, directory, base, branch string) (Source, error)
- func OpenPatch(input string) (Source, error)
- func OpenRepository(ctx context.Context, directory string) (Source, error)
- type StableRepositoryIdentity
- type Support
- type Worktree
- type WorktreeChangeSummary
Constants ¶
const ( MaxInputBytes = 16 * 1024 * 1024 MaxFileBytes = 2 * 1024 * 1024 )
const MaxCommits = review.MaxCommits
MaxCommits is how many of a branch's newest commits Commits captures, so object prefetchers cover exactly what collection reads.
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 default branch available for comparison")
ErrNoDefaultBranch means no existing default branch ref can be resolved.
var ErrNotRepository = errors.New("not a Git working tree")
Functions ¶
func ActivityTime ¶ added in v0.2.1
ActivityTime estimates code activity for the captured target. Objects-only comparisons never consult the unrelated checkout's files or index.
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 DefaultBaselines ¶ added in v0.2.1
DefaultBaselines resolves existing refs for the first default branch name (`origin/HEAD`, `main`, then `master`) with a local or remote-tracking ref: the local branch first, then its remote-tracking upstream or origin counterpart. It never fetches or consults a feature branch's upstream, which may simply track that same feature branch.
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 CommitRange ¶ added in v0.2.2
CommitRange is a branch comparison's captured commits, oldest first. Total counts the whole merge-base..HEAD range, including commits beyond the cap.
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 CommitSource ¶ added in v0.2.2
CommitSource reads one captured commit's diff against its first parent, within the branch comparison that listed it.
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.