Documentation
¶
Overview ¶
Package diff builds whole-file line models for changed files: every line of the new file with deletions interleaved, ready to render with changed lines highlighted in full context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileDiff ¶
type FileDiff struct {
File git.ChangedFile
Stat git.FileStat
Lines []Line
OldTotal int
NewTotal int
Changes []int // indices where add/del runs begin, for jump keys
Binary bool
Truncated bool
Err error
// contains filtered or unexported fields
}
func BuildFile ¶
BuildFile diffs two file versions into the whole-file line model: every new-file line in order, with deleted old lines interleaved ahead of the lines that replaced them.
func LoadFile ¶ added in v0.10.3
LoadFile builds one file's line model without mutating set, which makes it safe to call from an asynchronous UI command using a snapshot of the set.
func (*FileDiff) Loaded ¶ added in v0.10.3
Loaded reports whether the file's contents have been read and modeled.
func (*FileDiff) SideBySideRows ¶
type Row ¶
type Row struct {
Left, Right int
}
Row addresses one side-by-side display row; -1 means a blank cell.
type Set ¶
type Set struct {
Repo git.Repo
Scope git.Scope
BaseDesc string
BaseRef string
BaseOverride string
Files []FileDiff
}
func BuildSet ¶
BuildSet loads only the changed-file metadata for a scope. File contents and line models are loaded on demand so large reviews can show their file list without waiting for every file to be read and diffed. A non-empty baseOverride selects the ScopeBranch base and fails loudly when it no longer resolves; empty keeps auto-detection.