mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-04 02:51:31 -08:00
Relax the condition on the values of DIRS in project-files
* lisp/progmodes/project.el (project-files): Use 'file-in-directory-p' to dispatch to 'project--vc-list-files' when listing subdirectory files too (bug#79809).
This commit is contained in:
parent
223dffabd8
commit
48a4444977
2 changed files with 17 additions and 3 deletions
|
|
@ -369,8 +369,8 @@ the user.")
|
|||
|
||||
(cl-defgeneric project-files (project &optional dirs)
|
||||
"Return a list of files in directories DIRS in PROJECT.
|
||||
DIRS is a list of absolute directories; it should be some
|
||||
subset of the project root and external roots.
|
||||
DIRS is a list of absolute directories; the values can be some of the
|
||||
project roots or external roots or subdirectories of those.
|
||||
|
||||
The default implementation uses `find-program'. PROJECT is used
|
||||
to find the list of ignores for each directory."
|
||||
|
|
@ -679,7 +679,7 @@ See `project-vc-extra-root-markers' for the marker value format.")
|
|||
(backend (cadr project)))
|
||||
(when backend
|
||||
(require (intern (concat "vc-" (downcase (symbol-name backend))))))
|
||||
(if (and (file-equal-p dir (nth 2 project))
|
||||
(if (and (file-in-directory-p dir (nth 2 project))
|
||||
(cond
|
||||
((eq backend 'Hg))
|
||||
((and (eq backend 'Git)
|
||||
|
|
|
|||
|
|
@ -157,6 +157,20 @@ When `project-ignores' includes a name matching project dir."
|
|||
(should (equal '(".dir-locals.el" "foo")
|
||||
(mapcar #'file-name-nondirectory (project-files project))))))
|
||||
|
||||
(ert-deftest project-vc-supports-files-in-subdirectory ()
|
||||
"Check that it lists only files from subdirectory."
|
||||
(skip-unless (eq (vc-responsible-backend default-directory) 'Git))
|
||||
(let* ((dir (ert-resource-directory))
|
||||
(_ (vc-file-clearprops dir))
|
||||
(project-vc-extra-root-markers '("project-tests.el"))
|
||||
(project (project-current nil dir)))
|
||||
(should-not (null project))
|
||||
(should (string-match-p "/test/lisp/progmodes/\\'" (project-root project)))
|
||||
(should (equal '(".dir-locals.el" "etc" "foo")
|
||||
(mapcar #'file-name-nondirectory
|
||||
(project-files project
|
||||
(list dir)))))))
|
||||
|
||||
(ert-deftest project-vc-nonexistent-directory-no-error ()
|
||||
"Check that is doesn't error out when the current dir does not exist."
|
||||
(skip-unless (eq (vc-responsible-backend default-directory) 'Git))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue