Documentation
¶
Overview ¶
Package testgit runs test Git commands without the caller's GIT_* variables. Test-only: never import it from production code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Command ¶
Command builds a Git command rooted at dir. Hooks export GIT_DIR, GIT_INDEX_FILE and friends; cmd.Dir alone does not isolate a test repository. Keep non-Git environment variables and disable system Git configuration. Tests that commit must provide their own identity (local config or -c flags).
func Env ¶ added in v0.10.22
func Env() []string
Env returns the process environment with every GIT_* variable removed and GIT_CONFIG_NOSYSTEM=1 set.
func Run ¶
Run executes a Git command, returning its combined output and failing the calling test with that output if the command fails. Use Command for expected nonzero exits or when the command needs further customization.
func ShellCommand ¶ added in v0.10.22
ShellCommand builds a bash -c command without the caller's GIT_* variables. Hooks export GIT_DIR, GIT_INDEX_FILE and friends; cmd.Dir alone does not isolate a test repository. An empty dir leaves cmd.Dir unset.
Types ¶
This section is empty.