Help us shape the future of Go! Take the 2026 Go Developer Survey

diff

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package diff builds line models for changed files, using full-file context for small files and changed hunks for large ones.

Index

Constants

View Source
const (
	Same = model.Same
	Add  = model.Add
	Del  = model.Del
	Gap  = model.Gap
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDiff

type FileDiff = model.FileDiff

func BuildFile

func BuildFile(oldContent, newContent []byte, file git.ChangedFile, stat git.FileStat) FileDiff

BuildFile interleaves deletions with new-file lines. Large files show only changed hunks, with gap markers for omitted context.

func LoadFile added in v0.10.3

func LoadFile(driver *git.Driver, set Set, index int) FileDiff

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.

type Line

type Line = model.Line

type LineKind

type LineKind = model.LineKind

type Row

type Row = model.Row

type Set

type Set = model.Set

func BuildSet

func BuildSet(driver *git.Driver, cwd string, scope git.Scope, baseOverride string) (Set, error)

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.

type Span

type Span = model.Span

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL