gitx

package
v1.0.0 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitx runs the system git binary. KanArtist shells out to git rather than embedding a git implementation so it inherits the user's credential helpers, SSH config and performance (PRD §8.1).

Index

Constants

This section is empty.

Variables

View Source
var MinVersion = [2]int{2, 40}

MinVersion is the oldest git ka supports.

Functions

func IsNonFastForward

func IsNonFastForward(err error) bool

IsNonFastForward reports whether a push failed because the remote moved.

func ParseTrailers

func ParseTrailers(msg string) map[string]string

ParseTrailers reads "Key: value" lines from the last paragraph of a message.

func Toplevel

func Toplevel(ctx context.Context, dir string) (string, error)

Toplevel returns the root of the working tree containing dir.

func Version

func Version(ctx context.Context) (int, int, string, error)

Version returns git's major and minor version.

Types

type Commit

type Commit struct {
	SHA      string
	Subject  string
	Body     string
	Author   string // "Name <email>"
	Date     string // author date, strict ISO 8601
	Trailers map[string]string
}

Commit is one commit with its message trailers.

type Error

type Error struct {
	Args   []string
	Code   int
	Stderr string
}

Error is a failed git invocation.

func (*Error) Error

func (e *Error) Error() string

type Repo

type Repo struct {
	Dir string
	// Env is appended to the environment of every invocation.
	Env []string
}

Repo is a git working tree.

func (*Repo) Branch

func (r *Repo) Branch(ctx context.Context) string

Branch returns the current branch name, or "" when detached.

func (*Repo) ChangedPaths

func (r *Repo) ChangedPaths(ctx context.Context, from, to string) ([]string, error)

ChangedPaths lists files that differ between two commits.

func (*Repo) CommitInfo

func (r *Repo) CommitInfo(ctx context.Context, rev string) (*Commit, error)

CommitInfo returns one commit's metadata and message.

func (*Repo) GitDir

func (r *Repo) GitDir(ctx context.Context) (string, error)

GitDir returns the absolute .git directory.

func (*Repo) Head

func (r *Repo) Head(ctx context.Context) string

Head returns the commit HEAD points at, or "" in an empty repository.

func (*Repo) InProgress

func (r *Repo) InProgress(ctx context.Context) string

InProgress reports a rebase, merge or cherry-pick left in the working tree.

func (*Repo) Log

func (r *Repo) Log(ctx context.Context, revRange string, reverse bool, paths ...string) ([]Commit, error)

Log returns commits in rev range (oldest first when reverse is true).

func (*Repo) OK

func (r *Repo) OK(ctx context.Context, args ...string) bool

OK runs git and reports whether it exited 0.

func (*Repo) Recent

func (r *Repo) Recent(ctx context.Context, n int, before string, paths ...string) ([]Commit, error)

Recent returns up to n commits reachable from HEAD, newest first, optionally only those authored before a time (RFC 3339).

func (*Repo) Run

func (r *Repo) Run(ctx context.Context, args ...string) (string, error)

Run runs git with args in the repo and returns trimmed stdout.

func (*Repo) RunRaw

func (r *Repo) RunRaw(ctx context.Context, stdin []byte, args ...string) ([]byte, error)

RunRaw runs git with optional stdin and returns raw stdout.

func (*Repo) Status

func (r *Repo) Status(ctx context.Context, paths ...string) ([]string, error)

Status lists paths with uncommitted changes (porcelain v1, -z).

func (*Repo) Upstream

func (r *Repo) Upstream(ctx context.Context) (remote, branch string)

Upstream returns the remote and remote branch the current branch tracks.

Jump to

Keyboard shortcuts

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