gitdiff

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gitdiff ports bat's diff module: it computes per-line modifications (added / removed / modified) between a file's working-tree state and the git index, so the printer can draw change markers in the gutter. It shells out to the git CLI with -U0 and parses the resulting hunk headers, mirroring the classification libgit2 performs in upstream bat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineChange

type LineChange int

LineChange classifies a single line's git status.

const (
	Added LineChange = iota
	RemovedAbove
	RemovedBelow
	Modified
)

type LineChanges

type LineChanges map[int]LineChange

LineChanges maps 1-based line numbers to their change kind.

func Get

func Get(filename string) LineChanges

Get returns the line changes for filename, or nil if it is not in a git repository or git is unavailable.

Jump to

Keyboard shortcuts

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