Discover Packages
github.com/mhvelplund/git-stack
internal
testutil
package
Version:
v1.0.2
Opens a new window with list of versions in this module.
Published: Oct 25, 2026
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package testutil builds throwaway git repositories for tests.
Main runs the package's tests with the user's git config kept out of every
git process. It sets the environment once for the whole process, so tests
that use NewRepo can call t.Parallel. Call it from TestMain.
Repo is a working clone with a bare "origin" next to it.
NewRepo creates a bare origin with one commit on main and clones it.
Clone returns a fresh clone of the origin, e.g. to act as a teammate.
Commit writes file and commits it on the current branch.
Git runs git in the working clone and returns trimmed stdout.
PushFromElsewhere commits file on branch in a separate clone and pushes it,
simulating someone else updating the remote.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.