1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-12 19:18:24 +02:00

Look for global git/ignore in ~/.config/git, not ~/git

The documentation says:

> If `$XDG_CONFIG_HOME` is not set or is empty, then
> `$HOME/.config/git/ignore` is used instead.

This is the expected behavior, but the code looked at ~/git/ignore
instead.
This commit is contained in:
Daniel Hahler 2017-01-29 16:30:56 +01:00 committed by Andrew Gallant
parent 72e3c54e0a
commit 6e209b6fdb

View File

@ -454,7 +454,7 @@ fn gitconfig_contents() -> Option<Vec<u8>> {
fn excludes_file_default() -> Option<PathBuf> {
env::var_os("XDG_CONFIG_HOME")
.and_then(|x| if x.is_empty() { None } else { Some(PathBuf::from(x)) })
.or_else(|| env::home_dir())
.or_else(|| env::home_dir().map(|p| p.join(".config")))
.map(|x| x.join("git/ignore"))
}