Help us shape the future of Go! Take the 2026 Go Developer Survey

testgit

package
v0.10.17 Latest Latest
Warning

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

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

Documentation

Overview

Package testgit runs test Git commands without the caller's GIT_* variables. Test-only: never import it from production code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(tb testing.TB, dir string, args ...string) *exec.Cmd

Command builds a Git command rooted at dir. Hooks export GIT_DIR, GIT_INDEX_FILE and friends; cmd.Dir alone does not isolate a test repository. Keep non-Git environment variables and disable system Git configuration. Tests that commit must provide their own identity (local config or -c flags).

func Run

func Run(tb testing.TB, dir string, args ...string) []byte

Run executes a Git command, returning its combined output and failing the calling test with that output if the command fails. Use Command for expected nonzero exits or when the command needs further customization.

Types

This section is empty.

Jump to

Keyboard shortcuts

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