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

gitutil

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package gitutil provides hermetic Git subprocess construction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HermeticGitCommand

func HermeticGitCommand(args ...string) *exec.Cmd

HermeticGitCommand constructs a Git command insulated from the surrounding developer's Git setup, in two ways.

It drops repository-local environment variables inherited from a parent Git hook. Those take precedence over cmd.Dir and `git -C`, which can make a nested command operate on the repository whose hook is running instead of its explicit target.

It also disables HOOKS. A developer with a global `core.hooksPath` — rsry installs one that rejects any commit message without a bead reference — had their hooks run inside mache's own temp repositories, and seven tests in internal/mcpserve failed on `git commit -m "init"` for a machine-local reason CI cannot see. Hooks are wrong for every call site here regardless: these are read-only queries (rev-parse, log, remote get-url) and throwaway clones, none of them a commit the developer authored.

func WithoutLocalEnv

func WithoutLocalEnv(env []string) []string

WithoutLocalEnv removes the variables listed by `git rev-parse --local-env-vars`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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