Documentation
¶
Overview ¶
Package gitio wraps the git CLI for the small set of operations histomancer actually needs: opening or initialising a repo, reading the branch tip and the file at it, running a fast-import stream against the repo, and pushing.
It deliberately shells out to git rather than linking a library, because the git CLI is the lowest-common-denominator everyone already has installed and fast-import is the documented integration boundary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
Path string // absolute path to the repository working tree
}
Repo is an opened or freshly initialised git repository on the local disk.
func Init ¶
Init creates a new empty git repository at path with branch as the initial branch name and returns a handle to it.
func (*Repo) Config ¶
Config returns the value of a git config key (e.g. "user.email"), cascading through local → global → system per git's normal lookup. Returns "" with no error when the key is unset, so callers can distinguish "missing" from a hard read failure.
func (*Repo) FileAtHead ¶
FileAtHead returns the contents of repoPath at the tip of branch. Returns (nil, nil) if the file does not exist at that revision (no error — that's the natural starting state).
func (*Repo) HeadSHA ¶
HeadSHA returns the SHA of the tip of branch, or an empty string if the branch does not exist yet (which is the expected state in fresh mode).
func (*Repo) RunFastImport ¶
RunFastImport spawns `git fast-import --done` against the repo and invokes write with its stdin. write should finalize the stream with the encoder's Done() — RunFastImport closes the pipe and waits for git to exit.