testutil

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 5 Imported by: 0

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

func TempGitRepo(t *testing.T) string

TempGitRepo creates a temporary git repository. Returns the repository path. Automatically cleaned up.

func TempGitRepoWithBranch

func TempGitRepoWithBranch(t *testing.T, branchName string) string

TempGitRepoWithBranch creates a temp git repo with an initial commit and a branch.

func TempGitRepoWithCommit

func TempGitRepoWithCommit(t *testing.T) string

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").

Directories

Path Synopsis
Package builders provides fluent test fixture builders for git operations.
Package builders provides fluent test fixture builders for git operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL