{"modulePath":"github.com/github/git-sizer","version":"v1.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testutils\n\n## Functions\n\n```go\nfunc AddAuthorInfo(cmd *exec.Cmd, timestamp *time.Time)\n```\nAddAuthorInfo adds environment variables to \\`cmd.Env\\` that set the Git author and committer to known values and set the timestamp to \\`\\*timestamp\\`. Then \\`\\*timestamp\\` is moved forward by a minute, so that each commit gets a unique timestamp.\n\n```go\nfunc CleanGitEnv() []string\n```\nCleanGitEnv returns a clean environment for running \\`git\\` commands so that they won't be affected by the local environment.\n\n## Types\n\n```go\ntype TestRepo struct {\n\tPath string\n\t// contains filtered or unexported fields\n}\n```\nTestRepo represents a git repository used for tests.\n\n```go\nfunc NewTestRepo(t *testing.T, bare bool, pattern string) *TestRepo\n```\nNewTestRepo creates and initializes a test repository in a temporary directory constructed using \\`pattern\\`. The caller must delete the repository by calling \\`repo.Remove()\\`.\n\n```go\nfunc (repo *TestRepo) AddFile(t *testing.T, relativePath, contents string)\n```\nAddFile adds and stages a file in \\`repo\\` at path \\`relativePath\\` with the specified \\`contents\\`. This must be run in a non-bare repository.\n\n```go\nfunc (repo *TestRepo) Clone(t *testing.T, pattern string) *TestRepo\n```\nClone creates a clone of \\`repo\\` at a temporary path constructued using \\`pattern\\`. The caller is responsible for removing it when done by calling \\`Remove()\\`.\n\n```go\nfunc (repo *TestRepo) ConfigAdd(t *testing.T, key, value string)\n```\nConfigAdd adds a key-value pair to the gitconfig in \\`repo\\`.\n\n```go\nfunc (repo *TestRepo) CreateObject(\n\tt *testing.T, otype git.ObjectType, writer func(io.Writer) error,\n) git.OID\n```\nCreateObject creates a new Git object, of the specified type, in the repository at \\`repoPath\\`. \\`writer\\` is a function that generates the object contents in \\`git hash-object\\` input format.\n\n```go\nfunc (repo *TestRepo) CreateReferencedOrphan(t *testing.T, refname string)\n```\nCreateReferencedOrphan creates a simple new orphan commit and points the reference with name \\`refname\\` at it. This can be run in a bare or non-bare repository.\n\n```go\nfunc (repo *TestRepo) GitCommand(t *testing.T, args ...string) *exec.Cmd\n```\nGitCommand creates an \\`\\*exec.Cmd\\` for running \\`git\\` in \\`repo\\` with the specified arguments.\n\n```go\nfunc (repo *TestRepo) Init(t *testing.T, bare bool)\n```\nInit initializes a git repository at \\`repo.Path\\`.\n\n```go\nfunc (repo *TestRepo) Remove(t *testing.T)\n```\nRemove deletes the test repository at \\`repo.Path\\`.\n\n```go\nfunc (repo *TestRepo) Repository(t *testing.T) *git.Repository\n```\nRepository returns a \\`\\*git.Repository\\` for \\`repo\\`.\n\n```go\nfunc (repo *TestRepo) UpdateRef(t *testing.T, refname string, oid git.OID)\n```\nUpdateRef updates the reference named \\`refname\\` to the value \\`oid\\`.\n\n","path":"github.com/github/git-sizer/internal/testutils","name":"testutils","synopsis":"","isRedistributable":true}
