@matheusbsbs / matheus-bagliano / commits / 274e13e0e9
Fork 0

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>

Alexandre Julliard committed Jul 31, 2007 at 12:36 UTC 274e13e0e9c7e475bbc342a10d614dd40b0e4c15
1 file changed +15 -5
contrib/emacs/git.el
+15 -5
@@ -589,6 +589,16 @@ Return the list of files that haven't been handled."
589 (when node (push (ewoc-data node) unmerged-files))))
590 (git-set-files-state unmerged-files 'unmerged))))
591
592 +(defun git-get-exclude-files ()
593 + "Get the list of exclude files to pass to git-ls-files."
594 + (let (files
595 + (config (git-config "core.excludesfile")))
596 + (when (file-readable-p ".git/info/exclude")
597 + (push ".git/info/exclude" files))
598 + (when (and config (file-readable-p config))
599 + (push config files))
600 + files))
601 +
602 (defun git-update-status-files (files &optional default-state)
603 "Update the status of FILES from the index."
604 (unless git-status (error "Not in git-status buffer."))
@@ -598,11 +608,11 @@ Return the list of files that haven't been handled."
608 (git-run-ls-files status files 'added "-c")
609 (git-run-diff-index status files))))
610 (git-run-ls-unmerged status files)
601 - (when (and (or (not files) remaining-files)
602 - (file-readable-p ".git/info/exclude"))
603 - (setq remaining-files (git-run-ls-files status remaining-files
604 - 'unknown "-o" "--exclude-from=.git/info/exclude"
605 - (concat "--exclude-per-directory=" git-per-dir-ignore-file))))
611 + (when (or (not files) remaining-files)
612 + (let ((exclude-files (git-get-exclude-files)))
613 + (setq remaining-files (apply #'git-run-ls-files status remaining-files 'unknown "-o"
614 + (concat "--exclude-per-directory=" git-per-dir-ignore-file)
615 + (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
616 ; mark remaining files with the default state (or remove them if nil)
617 (when remaining-files
618 (if default-state