Documentation
¶
Overview ¶
Package gitcommand reads repository state and runs Git commands with the supplied context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseStatusPaths ¶
ParseStatusPaths reads the paths of `git status --porcelain=v1 -z` output. For a rename or copy it returns the new path and skips the original one.
Types ¶
type Output ¶
Output contains a Git query's separate output streams, including warnings written to stderr when Git exits successfully.
func Query ¶
func Query(ctx context.Context, git, root string, environment []string, args ...string) (Output, error)
Query runs one local Git query with a deadline and bounded pipe draining. A nil environment uses Command's repository environment; a supplied environment replaces it so discovery can preserve its filesystem and pathspec settings.
type Worktree ¶
type Worktree struct {
// Head is the full commit ID HEAD names. It is empty before the first commit.
Head string
// Changes lists modified, added, deleted, renamed and untracked paths
// relative to the repository root, with forward slashes, in Git's order.
// Ignored files are not listed.
Changes []string
}
Worktree is the commit a repository's HEAD names and the paths that differ from it in the index or working tree.
func ReadWorktree ¶
ReadWorktree reads HEAD and the uncommitted changes of the repository at root with two local Git queries. It does not fetch, prompt or run the repository's fsmonitor.