Skip to main content

git_command

Function git_command 

Source
pub fn git_command(repo: &Path) -> Command
Expand description

A git command pinned to repo and stripped of every inherited variable that could redirect it somewhere else.

Use this for every production git invocation instead of building Command::new("git") directly. GIT_EXEC_PATH is deliberately left alone: it only locates git’s own helper binaries and cannot change which repository git acts on.

Clearing GIT_CONFIG_COUNT is sufficient to neutralize any inherited GIT_CONFIG_KEY_n/GIT_CONFIG_VALUE_n pair — git only reads those when the count is set — so they need no separate sweep.