Documentation
¶
Overview ¶
Package testutil provides helpers for creating temporary git repositories in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TempGitRepo ¶
TempGitRepo creates a temporary git repository. Returns the repository path. Automatically cleaned up.
func TempGitRepoWithBranch ¶
TempGitRepoWithBranch creates a temp git repo with an initial commit and a branch.
func TempGitRepoWithCommit ¶
TempGitRepoWithCommit creates a temp git repo with an initial commit. Any setup failure is fatal: a helper named ...WithCommit must not hand back a HEAD-less repository and let the test exercise a different state.
Types ¶
type WorktreeOrigin ¶
type WorktreeOrigin struct {
Origin string // bare repository used as the remote
Clone string // non-bare clone
Worktree string // linked worktree of Clone
Remote string // remote name configured on Clone
}
WorktreeOrigin is a local-only fixture: a bare origin, a clone of that origin, and a linked worktree of the clone.
func TempWorktreeWithBareOrigin ¶
func TempWorktreeWithBareOrigin(t *testing.T) *WorktreeOrigin
TempWorktreeWithBareOrigin builds a bare origin, a clone, and a linked worktree. The clone's remote is named "origin".
func TempWorktreeWithBareOriginRemote ¶
func TempWorktreeWithBareOriginRemote(t *testing.T, remote string) *WorktreeOrigin
TempWorktreeWithBareOriginRemote is TempWorktreeWithBareOrigin with a caller-chosen remote name (for cases where the remote is not "origin").