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

gitenv

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gitenv builds environments for invoking git as a subprocess.

Git exports its repository-discovery variables to every hook it runs, so any process a hook starts inherits them — including `go test ./...` run by a pre-commit hook. Those variables take precedence over a `-C <dir>` argument, so an inheriting subprocess operates on the hook's repository rather than the directory it was pointed at. For a test that runs `git init` in a temporary fixture, that means re-initializing the developer's own checkout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithoutDiscovery

func WithoutDiscovery() []string

WithoutDiscovery returns the current process environment with every repository-discovery variable removed, so git resolves the repository from the directory it is given. Assign it to exec.Cmd.Env whenever a git subprocess is pointed at a specific directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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