Documentation
¶
Index ¶
- func IsSagaPath(path string) bool
- func Key(atom Atom) string
- func VerifyRepository(ctx context.Context, repo, declared string) error
- type Atom
- type Catalog
- type ChangeSet
- func Read(ctx context.Context, fromDir, repositoryURI, base, head string) (ChangeSet, error)
- func ReadFile(ctx context.Context, fromDir string, catalog Catalog, file FileSummary) (ChangeSet, error)
- func ReadWithOptions(ctx context.Context, fromDir, repositoryURI, base, head string, ...) (ChangeSet, error)
- type DisplayLine
- type FileSummary
- type ReadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSagaPath ¶
Types ¶
type Atom ¶
type Atom struct {
Key string `json:"key"`
URI string `json:"uri"`
Kind string `json:"kind"`
Path string `json:"path,omitempty"`
Side string `json:"side,omitempty"`
Line int `json:"line,omitempty"`
Content string `json:"content"`
Event string `json:"event,omitempty"`
OldPath string `json:"old_path,omitempty"`
NewPath string `json:"new_path,omitempty"`
}
Atom is the smallest independently coverable unit of a comparison. Kind discriminates the shape: a "line" atom always carries path, side, line, and content; an "event" atom always carries event. Content is emitted even when the changed line is empty, so a consumer can read it unconditionally instead of having to distinguish a blank line from an absent field.
type Catalog ¶ added in v0.0.8
type Catalog struct {
Repository string `json:"repository"`
Base string `json:"base"`
Head string `json:"head"`
BaseOID string `json:"base_oid"`
HeadOID string `json:"head_oid"`
HeadCommit string `json:"head_commit"`
Files []FileSummary `json:"files"`
}
Catalog is the bounded source-comparison identity and changed-file list used by review navigation. It deliberately contains no patch bodies or per-line atoms: opening Code can therefore enumerate files without constructing the complete comparison first.
func ReadCatalog ¶ added in v0.0.8
ReadCatalog resolves the exact same comparison identity as Read while asking Git only for NUL-delimited per-file statistics. Its memory use is therefore proportional to changed files rather than changed lines.
func ReadCatalogWithOptions ¶ added in v0.0.8
type ChangeSet ¶
type ChangeSet struct {
Repository string `json:"repository"`
Base string `json:"base"`
Head string `json:"head"`
BaseOID string `json:"base_oid"`
HeadOID string `json:"head_oid"`
Atoms []Atom `json:"atoms"`
SagaChanges []Atom `json:"saga_changes"`
// DisplayLines contains bounded unchanged context alongside changed atoms.
// It is renderer-only: coverage and persisted diff identity continue to use
// Atoms exclusively.
DisplayLines []DisplayLine `json:"-"`
}
func ReadFile ¶ added in v0.0.8
func ReadFile(ctx context.Context, fromDir string, catalog Catalog, file FileSummary) (ChangeSet, error)
ReadFile emits and parses only one catalog entry. The catalog supplies the already-hashed comparison identity, while both rename paths are passed to Git so the focused patch preserves the whole-comparison file identity.
func ReadWithOptions ¶
type DisplayLine ¶
type FileSummary ¶ added in v0.0.8
type FileSummary struct {
Path string `json:"path"`
OldPath string `json:"old_path,omitempty"`
NewPath string `json:"new_path,omitempty"`
Added int `json:"added"`
Deleted int `json:"deleted"`
Binary bool `json:"binary,omitempty"`
}
FileSummary is the metadata Git can report without emitting a patch body. OldPath and NewPath preserve rename/copy identity; Path is the current path reviewers select (the new path when one exists).
type ReadOptions ¶
type ReadOptions struct {
AllowRepositoryMismatch bool
}