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

gitx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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 from HEAD")

ErrNoTag is LatestTag finding no tag reachable from HEAD.

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 LatestTag

func LatestTag(root string) (string, error)

LatestTag is the newest tag reachable from HEAD.

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