Files
ripgrep/tests
Amaan Qureshi 241b87b337 ignore: support GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM for core.excludesFile
`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
2026-07-09 13:49:32 -04:00
..
2018-08-20 07:10:19 -04:00
2025-09-19 21:08:19 -04:00
2020-02-17 19:24:53 -05:00