gitdiff

package
v0.0.0-...-fa032f6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package gitdiff reads a commit range from a local repository with the git binary and analyses it with the review package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, dir string, opts Options) (*review.Overview, error)

Build analyses and groups the range selected by opts in the repository at dir. Declarations and links between files come from an outline graph of the head tree; if that graph can't be built the overview carries a warning and is grouped without it. If ctx ends, Build returns ctx.Err().

func Diff

func Diff(ctx context.Context, dir string, rng review.Range, paths []string, w io.Writer) error

Diff writes git's patch for paths between the two commits of rng. Paths are relative to the repository root, as in an overview, wherever dir is.

Types

type Options

type Options struct {
	Base      string
	Head      string
	MergeBase bool
}

Options select the commits to compare. An empty Base means the default branch, an empty Head means HEAD. MergeBase compares Head against the merge base of the two, as a pull request does.

func ParseRange

func ParseRange(args []string) (Options, error)

ParseRange turns command-line revisions into Options using git's range syntax: "a..b" compares a and b directly, while "a...b", "a b" and a lone "a" compare against the merge base.

Jump to

Keyboard shortcuts

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