gitread

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gitread reads git repository state straight out of .git, with no exec dependency and no git library: the daemon must work on machines where a git binary may not exist, and hooks fire on every prompt. The readers back the provenance stamp on captured plans and subagent notes (internal/hooks) and the gardener's stale-plan ship evidence (internal/gardener). Every failure yields a zero value -- all reads are best-effort by design.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Head(cwd string) string

Head resolves the repo's current commit at cwd: a detached HEAD is the hash itself; a symbolic ref is dereferenced via its loose ref file, then packed-refs, following a worktree's gitdir pointer and commondir. Any failure yields "".

Types

type ReflogEntry

type ReflogEntry struct {
	Old, New string
	Message  string
}

ReflogEntry is one HEAD reflog line: HEAD moved from Old to New, and Message says why ("commit: <subject>", "merge <branch>: Fast-forward", "checkout: moving from a to b", ...).

func ReflogHEAD

func ReflogHEAD(cwd string) []ReflogEntry

ReflogHEAD returns the HEAD reflog at cwd, oldest first -- the repo's local record of every commit, merge, and checkout that moved HEAD. Worktrees keep their own HEAD log under their gitdir, so a worktree cwd reads that worktree's history. nil when the repo or its log cannot be read (a fresh clone, a pruned log): absent history is not evidence of anything.

Jump to

Keyboard shortcuts

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