From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH v2] Let core.excludesfile default to ~/.gitexcludes.
Date: Sat, 21 Nov 2009 23:00:32 +0100 [thread overview]
Message-ID: <1258840832-22130-1-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <4B06A7EE.2090801@atlas-elektronik.com>
Most users will set it to ~/.gitsomething. ~/.gitignore would conflict
with per-directory ignore file if ~/ is managed by Git, so ~/.gitexcludes
is a sane default.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Change since v1 : just changed gitignore -> gitexcludes.
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..13871a6 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: ~/.gitexcludes.
core.editor::
Commands such as `commit` and `tag` that lets you edit
diff --git a/dir.c b/dir.c
index d0999ba..cf3d8b4 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("/.gitexcludes") + 1);
+ strcpy(user_gitignore, home);
+ strcat(user_gitignore, "/.gitexcludes");
+ 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.3.435.g5f2e3.dirty
next prev parent reply other threads:[~2009-11-21 22:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 13:23 [PATCH] let core.excludesfile default to ~/.gitignore Matthieu Moy
2009-11-20 14:30 ` Stefan Naewe
2009-11-20 18:50 ` David Aguilar
2009-11-21 22:00 ` Matthieu Moy [this message]
2009-11-26 10:35 ` [PATCH (resend)] Let core.excludesfile default to ~/.gitexcludes Matthieu Moy
2009-11-26 12:00 ` Michael J Gruber
2009-11-26 12:49 ` Paolo Bonzini
2009-11-26 13:27 ` Michael J Gruber
2009-11-26 13:01 ` Bert Wesarg
2009-11-26 13:39 ` Michael J Gruber
2009-11-26 20:07 ` David Aguilar
2009-11-26 18:18 ` Junio C Hamano
2009-12-30 13:41 ` [PATCH v2] " Nanako Shiraishi
2009-12-30 14:31 ` Matthieu Moy
2009-12-30 19:49 ` Junio C Hamano
2010-01-02 12:05 ` User-wide Git config directory (was Re: [PATCH v2] Let core.excludesfile default to ~/.gitexcludes.) Matthieu Moy
2009-11-20 22:49 ` [PATCH] let core.excludesfile default to ~/.gitignore Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258840832-22130-1-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).