gitx

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gitx is the few git questions the gates and drivers ask, as one line of plumbing each. Anything that parses what git prints lives here, so two gates cannot read the same output two ways.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTag = errors.New("no tag reachable")

ErrNoTag is LatestTagOn finding no tag reachable.

Functions

func ChangedFiles

func ChangedFiles(root, from, to string) ([]string, error)

ChangedFiles lists the paths that differ between two revisions, sorted.

func Files

func Files(root string) ([]string, error)

Files lists what git would put in a commit from root: tracked files and untracked files that are not ignored, relative to root, slash-separated and sorted. A tracked file deleted from the work tree is left out, since there is nothing to read.

func LatestTagOn added in v4.2.1

func LatestTagOn(root, rev string) (string, error)

LatestTagOn is the tag git describe finds for rev: the nearest one rev reaches, which on a history tagged in order is the newest. A clone can hold tags rev does not reach, such as a fork that fetched upstream's: rev then has none. Any other failure is git's, and says so.

func MergeBase

func MergeBase(root, base, head string) (string, error)

MergeBase is the commit a pull request is measured from: the best common ancestor of base and head. The base SHA a pull request event records is stale in a stacked pull request; this is not.

func Messages

func Messages(root, from, to string) ([]string, error)

Messages are the full messages of the commits in from..to, newest first.

func Output

func Output(dir string, args ...string) (string, error)

Output runs git in dir and returns what it wrote to stdout. A failure carries git's own stderr, trimmed.

func Resolve

func Resolve(root, rev string) (string, error)

Resolve turns a revision into a full commit SHA.

func Root

func Root(dir string) (string, error)

Root is the top of the work tree dir is in.

func Show

func Show(root, rev, path string) ([]byte, error)

Show is a file's content at a revision.

func Tracked

func Tracked(root string) ([]string, error)

Tracked lists the files in the index, relative to root, sorted, with the same deleted-file rule as Files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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