Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 29, 2017

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 is my first Rust code, so it might be wrong..!

Copy link
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for catching this! This does appear to be a bug. I think you just need to fix the compile error and this should be good to go. Thanks!

@@ -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().join(".config"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need env::home_dir().map(|p| p.join(".config")) since env::home_dir() returns an Option<PathBuf>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That worked, thanks!

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.
@BurntSushi BurntSushi merged commit 6e209b6 into BurntSushi:master Jan 30, 2017
@blueyed blueyed deleted the home-config-for-git-ignore branch January 30, 2017 22:06
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.

2 participants