git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountLines

func CountLines(out string) int

CountLines counts non-empty lines, used for git stash list.

func FormatWhen

func FormatWhen(t, now time.Time) string

FormatWhen renders a short relative time, or a month-day date after two weeks.

func Show

func Show(root, hash string) (string, error)

Show returns a commit summary suitable for the preview pane.

Types

type Commit

type Commit struct {
	Hash    string
	Subject string
	When    time.Time
}

Commit is one git log row.

func ParseLog

func ParseLog(out string) ([]Commit, error)

ParseLog parses lines of hash, unix seconds, and subject separated by tabs.

type Snapshot

type Snapshot struct {
	Repo    bool
	Status  Status
	Commits []Commit
	Err     string
}

Snapshot is a point-in-time read of a working tree.

func Load

func Load(root string) Snapshot

Load runs git in root. Repo is false when root is not a repository.

type Status

type Status struct {
	Branch   string
	Upstream string
	Ahead    int
	Behind   int
	Staged   int
	Unstaged int
	Stash    int
	Detached bool
	Dirty    map[string]struct{}
}

Status is a branch and worktree summary from git status --porcelain=v2 --branch. Untracked paths count as unstaged.

func ParseStatus

func ParseStatus(out string) (Status, error)

ParseStatus parses porcelain v2 output that includes the branch header.

Jump to

Keyboard shortcuts

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