mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2026-10-12 02:01:38 +00:00
`gitconfig_excludes_path()` resolves the global gitignore by reading `core.excludesFile` from `$HOME/.gitconfig` and `$XDG_CONFIG_HOME/git/config`, but git 2.32 (June 2021) introduced `GIT_CONFIG_GLOBAL` and `GIT_CONFIG_SYSTEM` environment variables that override these locations. The `ignore` crate doesn't check either of them, so users who point `GIT_CONFIG_GLOBAL` at a non-standard path (e.g. NixOS managing git config at `/etc/git/config`) have their global gitignore silently ignored by ripgrep while `git` itself respects it. This commit checks `GIT_CONFIG_GLOBAL` before the hardcoded paths, matching git's semantics where it replaces both `$HOME/.gitconfig` and the XDG config. It also adds system-level config (`GIT_CONFIG_SYSTEM`, falling back to `/etc/gitconfig`) as a lowest-priority source for `core.excludesFile`, which the crate previously didn't consult at all. Fixes #3275, Closes #3276