Documentation
¶
Overview ¶
Package gittest provides utilities for testing git repositories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmdAs ¶
func CmdAs(ts *testscript.TestScript, neg bool, args []string)
CmdAs sets the author and committer of the commits that follow.
as 'User Name <user@example.com>'
func CmdAt ¶
func CmdAt(ts *testscript.TestScript, neg bool, args []string)
CmdAt sets the author and commit time of the commits that follow.
at <YYYY-MM-DDTHH:MM:SS>
func CmdGit ¶
func CmdGit(ts *testscript.TestScript, neg bool, args []string)
CmdGit runs a git command in the repository.
[!] git [args ...]
func CondGitVersion ¶ added in v0.6.0
CondGitVersion checks if the current version of Git is at least the given version.
Types ¶
type Config ¶
Config is a set of Git configuration values.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig is the default Git configuration for all test repositories.
type Fixture ¶
type Fixture struct {
// contains filtered or unexported fields
}
Fixture is a temporary directory that contains a Git repository built from a testscript file.
func LoadFixtureFile ¶
LoadFixtureFile loads a fixture file from the given path. The fixture file is expected to be testscript file that runs a series of git commands to set up a Git repository.
func LoadFixtureScript ¶
LoadFixtureScript loads a fixture from the testscript. It has access to the following commands in addition to testscript defaults:
type Version ¶ added in v0.6.0
type Version struct {
Major, Minor, Patch int
}
Version is a Git version string.
func ParseVersion ¶ added in v0.6.0
ParseVersion parses a Git version string. This must be in one of the following formats:
git version X.Y.Z (...) git version X.Y.Z X.Y.Z X.Y X
Where X, Y, and Z are integers.