It seems this is the value most users set, so let's make it the default. Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx> --- A funny experiment: http://www.google.com/search?q=core.excludesfile+-%22~/.gitignore%22 Results 1 - 10 of about 3,890 for core.excludesfile -"~/.gitignore" http://www.google.com/search?q=core.excludesfile+%22~/.gitignore%22 Results 1 - 10 of about 7,990 for core.excludesfile "~/.gitignore" So, most of the time someone mentions core.excludesfile on the web, ~/.gitignore is mentionned right after. I'd have expected a place near config.c to set the default value for any config variable, but I can't find such thing, so I guess the caller is the one that should set the default, which is what I do in the patch. Documentation/config.txt | 1 + dir.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 39d1226..0c55e52 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -384,6 +384,7 @@ core.excludesfile:: of files which are not meant to be tracked. "~/" is expanded to the value of `$HOME` and "~user/" to the specified user's home directory. See linkgit:gitignore[5]. + Default: ~/.gitignore. core.editor:: Commands such as `commit` and `tag` that lets you edit diff --git a/dir.c b/dir.c index d0999ba..dcea6ad 100644 --- a/dir.c +++ b/dir.c @@ -914,9 +914,16 @@ void setup_standard_excludes(struct dir_struct *dir) dir->exclude_per_dir = ".gitignore"; path = git_path("info/exclude"); + if (!excludes_file) { + const char *home = getenv("HOME"); + char *user_gitignore = malloc(strlen(home) + strlen("/.gitignore") + 1); + strcpy(user_gitignore, home); + strcat(user_gitignore, "/.gitignore"); + excludes_file = user_gitignore; + } if (!access(path, R_OK)) add_excludes_from_file(dir, path); - if (excludes_file && !access(excludes_file, R_OK)) + if (!access(excludes_file, R_OK)) add_excludes_from_file(dir, excludes_file); } -- 1.6.5.2.152.gbbe9e -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html