Documentation
¶
Overview ¶
Package gitcmd runs git in a repository for the commands that read the committed state beside the working tree: the default branch's ref, a file as the branch holds it, the tracked files under a directory, and a rename the index follows.
Index ¶
- func DefaultRef(ctx context.Context, root, branch string) (ref, commit string, err error)
- func InWorkTree(ctx context.Context, dir string) bool
- func Output(ctx context.Context, root string, args ...string) (string, error)
- func Prefix(ctx context.Context, dir string) (string, error)
- func Show(ctx context.Context, root, ref, path string) (content []byte, ok bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultRef ¶
DefaultRef is the ref holding the default branch's tree: origin's copy of the branch when the repository has one (what a pull-request build compares against), else the local branch. Neither is an error: the committed state has to come from somewhere.
func InWorkTree ¶
InWorkTree reports whether dir is inside a git working tree: a directory that is not has no committed state to compare with, and a check over it says nothing.
func Output ¶
Output runs one git command in the repository at root and returns its standard output; a failure carries what git said.
Types ¶
This section is empty.