gitxtest

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitxtest builds real git repositories for tests, isolated from the developer's git config so no global setting shapes a fixture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t testing.TB, dir string, args ...string) string

Run runs git in dir and returns its output.

Types

type Repo

type Repo struct {
	T   testing.TB
	Dir string
}

A Repo is a real repository a test builds.

func Clone

func Clone(t testing.TB, name string) Repo

Clone is a clone named name of an empty bare origin whose default branch is main; the caller commits and pushes the first history.

func Init

func Init(t testing.TB, dir, branch string) Repo

Init makes dir a repo on branch, with the default fixture identity.

func (Repo) At

func (r Repo) At(when string, args ...string) string

At runs git with a fixed author and committer date, its output trimmed.

func (Repo) Commit

func (r Repo) Commit(when, file, content, msg string)

Commit writes content to file and commits it at when.

func (Repo) Git

func (r Repo) Git(args ...string) string

Git runs git in the repo and returns its output.

func (Repo) Identity

func (r Repo) Identity(email, name string)

Jump to

Keyboard shortcuts

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