testgit

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package testgit is the one identity a test's git commit runs under. A hosted runner (ubuntu-latest) carries no global git identity, and the self-hosted benches do, so a test that commits in a scratch repository and leans on the machine's config is green on every bench and red on the hosted leg with `Author identity unknown` (run 37344601638). Every test that runs `git commit` takes its author and committer from here, through the command's environment, never t.Setenv and never the runner's config; the class test TestNoTestCommitsWithoutTheSharedGitIdentity (internal/ci/git_identity_class_test.go) refuses a commit that does not.

Index

Constants

View Source
const (
	Name  = "nova-test"
	Email = "nova-test@example.invalid"
)

Name and Email are the fixed author and committer of every test commit.

Variables

This section is empty.

Functions

func Env

func Env() []string

Env is the author and committer identity as environment variables, for a command whose Env the caller builds itself.

func Environ

func Environ(extra ...string) []string

Environ is the caller's environment, then Env, then extra: a later variable wins in os/exec, so the identity overrides any the runner's environment carries and extra overrides both.

func NoGlobalConfig

func NoGlobalConfig(t testing.TB) []string

NoGlobalConfig is the hosted runner's git on any machine: the system config off and the global config at a file under t.TempDir() that sets only user.useConfigOnly, so git never guesses an identity from the host name. A command run with it and without Env refuses to commit on a bench exactly as it does on ubuntu-latest.

Types

This section is empty.

Jump to

Keyboard shortcuts

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