Skip to content

fix(gix-path): skip the Git query without /etc/gitconfig - #3188

Merged
Sebastian Thiel (Byron) merged 2 commits into
GitoxideLabs:mainfrom
hood:fix/gix-path-absent-system-config
Nov 10, 2026
Merged

Sebastian Thiel (Byron) merged 2 commits into
GitoxideLabs:mainfrom
hood:fix/gix-path-absent-system-config

Conversation

@hood

@hood hood commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Written by Claude Code, an AI agent, working for Andrea Cappuccio (@hood). The measurements are the agent's own.

Follow-up to #3182: Linux distro Git still spawns git config when /etc/gitconfig doesn't exist, which is the default on Debian, Ubuntu and Arch.

Motivation

starship opens a repo in a fresh process for every prompt (starship/starship#7851). After #3182 Homebrew and Linux setups with an /etc/gitconfig skip the query, but a stock Debian box still runs it on every prompt, just to learn there's no installation config.

Change

For the Linux /usr/bin/git / /bin/git layout, a missing /etc/gitconfig now means "no installation config", same as the MSYS2 path already does ("the system path is valid even when absent"). This is what the query returns there anyway, since distro builds use prefix=/usr → sysconfdir=/etc.

Homebrew and other prefix-derived layouts still query Git when their config is missing, since that can mean the prefix was guessed wrong (e.g. a relocated Cellar), so missing_homebrew_config_is_queried stays as is.

Numbers

Debian bookworm container, starship prompt in a repo copied into the container, no /etc/gitconfig:

git processes per prompt (strace) median (hyperfine, 60 runs)
gitoxide main 2 (git config + an unrelated starship spawn) 14.4 ms ±1.2
this PR 1 (the unrelated one) 13.7 ms ±1.2

Small on Linux since spawns are cheap there, tbh, but it adds up when every process does it.

Tests

  • cargo test -p gix-path on macOS and in Debian bookworm
  • cargo clippy -p gix-path --all-targets -- -D warnings
  • new unit test absent_system_config_is_no_installation_config covers the missing system config, a missing prefix config (still queried), and an existing one

Follow-up to GitoxideLabs#3182. Linux `/usr/bin/git` and `/bin/git` are inferred
to read `/etc/gitconfig`, but when that file doesn't exist we still
ran `git config --show-origin`, only to learn there is no installation
config. That's the default on Debian, Ubuntu and Arch, so most Linux
users kept paying for the spawn in every process opening a repository,
for example every `starship` prompt.

Treat a missing system config like MSYS2 already does: it's valid even
when absent, and means no installation config. Prefix-derived layouts
such as Homebrew still query Git, since a missing file there can mean
the prefix was misidentified.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T00:38:26.861761Z 9aaebd3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Use a dedicated read-only fixture for the `gix-path` system-config regression
test, following the Windows tests. Prepare missing and existing configurations
in the fixture script so the test itself performs no writes.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron
Sebastian Thiel (Byron) force-pushed the fix/gix-path-absent-system-config branch from 2571c34 to bcd416b Compare November 10, 2026 05:03
@Byron
Sebastian Thiel (Byron) merged commit 3247e95 into GitoxideLabs:main Nov 10, 2026
28 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants