From: Dorab Patel <dorabpatel@gmail.com>
To: git@vger.kernel.org
Cc: Alexandre Julliard <julliard@winehq.org>,
Dorab Patel <dorabpatel@gmail.com>
Subject: [PATCH] git.el: handle default excludesfile properly
Date: Fri, 2 Mar 2018 19:48:03 -0800 [thread overview]
Message-ID: <20180303034803.21589-1-dorabpatel@gmail.com> (raw)
The previous version only looked at core.excludesfile for locating the
excludesfile. So, when core.excludesfile was not defined, it did not
use the possible default locations.
The current version uses either $XDG_CONFIG_HOME/git/ignore or
$HOME/.config/git/ignore for the default excludesfile location
depending on whether XDG_CONFIG_HOME is defined or not. As per the
documentation of gitignore.
Signed-off-by: Dorab Patel <dorabpatel@gmail.com>
---
contrib/emacs/git.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 97919f2d7..16c6b4c05 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -757,8 +757,12 @@ Return the list of files that haven't been handled."
(defun git-get-exclude-files ()
"Get the list of exclude files to pass to git-ls-files."
- (let (files
- (config (git-config "core.excludesfile")))
+ (let* (files
+ (defaultconfig (if (getenv "XDG_CONFIG_HOME")
+ (concat (file-name-as-directory (getenv "XDG_CONFIG_HOME")) "git/ignore")
+ (concat (file-name-as-directory (getenv "HOME")) ".config/git/ignore")))
+ (coreexcludes (git-config "core.excludesfile"))
+ (config (if coreexcludes coreexcludes defaultconfig)))
(when (file-readable-p ".git/info/exclude")
(push ".git/info/exclude" files))
(when (and config (file-readable-p config))
--
2.16.2
next reply other threads:[~2018-03-03 3:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-03 3:48 Dorab Patel [this message]
2018-03-03 8:42 ` [PATCH] git.el: handle default excludesfile properly Eric Sunshine
2018-03-04 1:36 ` Dorab Patel
2018-03-04 2:12 ` Eric Sunshine
2018-03-04 2:57 ` Dorab Patel
2018-03-04 4:34 ` Eric Sunshine
2018-03-05 2:36 ` Junio C Hamano
2018-03-06 11:54 ` Alexandre Julliard
2018-03-07 21:52 ` Dorab Patel
2018-03-08 9:41 ` Ævar Arnfjörð Bjarmason
2018-03-08 9:45 ` [PATCH] git{,-blame}.el: remove old bitrotting Emacs code Ævar Arnfjörð Bjarmason
2018-03-08 17:27 ` Junio C Hamano
2018-03-10 12:30 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2018-03-10 16:50 ` Martin Ågren
2018-03-13 18:40 ` Junio C Hamano
2018-03-08 17:55 ` [PATCH] " Kyle Meyer
2018-03-06 4:38 ` [PATCH v2] git.el: handle default excludesfile properly Dorab Patel
[not found] <EKzyQbDEJGG4Lm5YboF8xg@mail.gmail.com>
2018-03-10 18:45 ` [PATCH v3] git{,-blame}.el: remove old bitrotting Emacs code Ævar Arnfjörð Bjarmason
2018-03-13 18:53 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2018-03-13 22:14 ` Junio C Hamano
2018-03-27 16:57 ` [PATCH v3] " Jonathan Nieder
2018-04-11 20:42 ` [PATCH v4] " Ævar Arnfjörð Bjarmason
2018-04-12 2:19 ` Junio C Hamano
2018-04-12 6:52 ` Ævar Arnfjörð Bjarmason
2018-04-12 9:23 ` Junio C Hamano
2018-04-18 20:16 ` Todd Zullinger
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=20180303034803.21589-1-dorabpatel@gmail.com \
--to=dorabpatel@gmail.com \
--cc=git@vger.kernel.org \
--cc=julliard@winehq.org \
/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).