summaryrefslogtreecommitdiff
path: root/contrib/emacs
diff options
context:
space:
mode:
authorAlexandre Julliard <julliard@winehq.org>2007-07-31 10:36:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-01 06:05:43 (GMT)
commit274e13e0e9c7e475bbc342a10d614dd40b0e4c15 (patch)
tree4da4fa689a0130994b60c1af0c251b35147b7ec7 /contrib/emacs
parent61988f1127587f8597b8b41da78a65717851e1fa (diff)
downloadgit-274e13e0e9c7e475bbc342a10d614dd40b0e4c15.zip
git-274e13e0e9c7e475bbc342a10d614dd40b0e4c15.tar.gz
git-274e13e0e9c7e475bbc342a10d614dd40b0e4c15.tar.bz2
git.el: Take into account the core.excludesfile config option.
Also don't require .git/info/exclude to exist in order to list unknown files. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Acked-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/git.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 7470f13..f6102fc 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -589,6 +589,16 @@ Return the list of files that haven't been handled."
(when node (push (ewoc-data node) unmerged-files))))
(git-set-files-state unmerged-files 'unmerged))))
+(defun git-get-exclude-files ()
+ "Get the list of exclude files to pass to git-ls-files."
+ (let (files
+ (config (git-config "core.excludesfile")))
+ (when (file-readable-p ".git/info/exclude")
+ (push ".git/info/exclude" files))
+ (when (and config (file-readable-p config))
+ (push config files))
+ files))
+
(defun git-update-status-files (files &optional default-state)
"Update the status of FILES from the index."
(unless git-status (error "Not in git-status buffer."))
@@ -598,11 +608,11 @@ Return the list of files that haven't been handled."
(git-run-ls-files status files 'added "-c")
(git-run-diff-index status files))))
(git-run-ls-unmerged status files)
- (when (and (or (not files) remaining-files)
- (file-readable-p ".git/info/exclude"))
- (setq remaining-files (git-run-ls-files status remaining-files
- 'unknown "-o" "--exclude-from=.git/info/exclude"
- (concat "--exclude-per-directory=" git-per-dir-ignore-file))))
+ (when (or (not files) remaining-files)
+ (let ((exclude-files (git-get-exclude-files)))
+ (setq remaining-files (apply #'git-run-ls-files status remaining-files 'unknown "-o"
+ (concat "--exclude-per-directory=" git-per-dir-ignore-file)
+ (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
; mark remaining files with the default state (or remove them if nil)
(when remaining-files
(if default-state