mailing list mirror (one of many)
 help / Atom feed
From: Dorab Patel <>
Cc: Alexandre Julliard <>,
	Dorab Patel <>
Subject: [PATCH] git.el: handle default excludesfile properly
Date: Fri,  2 Mar 2018 19:48:03 -0800
Message-ID: <> (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 <>
 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))

             reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  3:48 Dorab Patel [this message]
2018-03-03  8:42 ` 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

Reply instructions:

You may reply publically 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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:
       or Tor2web:

AGPL code for this site: git clone public-inbox