Documentation
¶
Index ¶
- func ChdirTempDir(t *testing.T) string
- func CreateCommit(t testing.TB, dir, filename, content, message string)
- func InitEmptyTempRepo(t *testing.T) string
- func InitTempRepo(t *testing.T) string
- func NewRepo(t *testing.T) string
- func RunGit(t testing.TB, dir string, args ...string) string
- func WriteFile(t testing.TB, dir, filename, content string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChdirTempDir ¶
ChdirTempDir chdirs into a fresh temp dir for the duration of the test.
CAUTION: process cwd is shared, so a test that calls this cannot run in parallel with another test that also calls it (or runs git commands relying on cwd). Prefer passing dir explicitly where possible.
func CreateCommit ¶
CreateCommit writes a file then stages and commits it.
func InitEmptyTempRepo ¶ added in v0.7.0
InitEmptyTempRepo creates a temp git repo without any commits (no branches), chdirs into it, and returns the path. Like InitTempRepo but stops before the initial commit — useful for testing "no branches" error paths.
Same cwd-sharing caveat as InitTempRepo; cannot run in parallel.
func InitTempRepo ¶
InitTempRepo creates a temp git repo, chdirs into it, makes an initial commit, and returns the repo path.
Uses ChdirTempDir under the hood, so tests using InitTempRepo cannot run in parallel. Use NewRepo for parallel-safe tests that pass dir explicitly.
func NewRepo ¶
NewRepo creates a temp git repo without chdir-ing into it and returns its path. Safe to call from t.Parallel() tests.
Types ¶
This section is empty.