Fix setting project-vc-merge-submodules via .dir-locals.el
* lisp/progmodes/project.el (project--vc-merge-submodules-p): New function. (project-try-vc, project--vc-list-files): Use it.
This commit is contained in:
parent
e2f443df17
commit
2cc48d3d10
1 changed files with 20 additions and 14 deletions
|
@ -306,7 +306,7 @@ backend implementation of `project-external-roots'.")
|
||||||
(if (and
|
(if (and
|
||||||
;; FIXME: Invalidate the cache when the value
|
;; FIXME: Invalidate the cache when the value
|
||||||
;; of this variable changes.
|
;; of this variable changes.
|
||||||
project-vc-merge-submodules
|
(project--vc-merge-submodules-p root)
|
||||||
(project--submodule-p root))
|
(project--submodule-p root))
|
||||||
(let* ((parent (file-name-directory
|
(let* ((parent (file-name-directory
|
||||||
(directory-file-name root))))
|
(directory-file-name root))))
|
||||||
|
@ -396,19 +396,20 @@ backend implementation of `project-external-roots'.")
|
||||||
(split-string
|
(split-string
|
||||||
(apply #'vc-git--run-command-string nil "ls-files" args)
|
(apply #'vc-git--run-command-string nil "ls-files" args)
|
||||||
"\0" t)))
|
"\0" t)))
|
||||||
;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'.
|
(when (project--vc-merge-submodules-p default-directory)
|
||||||
(let* ((submodules (project--git-submodules))
|
;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'.
|
||||||
(sub-files
|
(let* ((submodules (project--git-submodules))
|
||||||
(mapcar
|
(sub-files
|
||||||
(lambda (module)
|
(mapcar
|
||||||
(when (file-directory-p module)
|
(lambda (module)
|
||||||
(project--vc-list-files
|
(when (file-directory-p module)
|
||||||
(concat default-directory module)
|
(project--vc-list-files
|
||||||
backend
|
(concat default-directory module)
|
||||||
extra-ignores)))
|
backend
|
||||||
submodules)))
|
extra-ignores)))
|
||||||
(setq files
|
submodules)))
|
||||||
(apply #'nconc files sub-files)))
|
(setq files
|
||||||
|
(apply #'nconc files sub-files))))
|
||||||
;; 'git ls-files' returns duplicate entries for merge conflicts.
|
;; 'git ls-files' returns duplicate entries for merge conflicts.
|
||||||
;; XXX: Better solutions welcome, but this seems cheap enough.
|
;; XXX: Better solutions welcome, but this seems cheap enough.
|
||||||
(delete-consecutive-dups files)))
|
(delete-consecutive-dups files)))
|
||||||
|
@ -429,6 +430,11 @@ backend implementation of `project-external-roots'.")
|
||||||
(lambda (s) (concat default-directory s))
|
(lambda (s) (concat default-directory s))
|
||||||
(split-string (buffer-string) "\0" t)))))))
|
(split-string (buffer-string) "\0" t)))))))
|
||||||
|
|
||||||
|
(defun project--vc-merge-submodules-p (dir)
|
||||||
|
(project--value-in-dir
|
||||||
|
'project-vc-merge-submodules
|
||||||
|
dir))
|
||||||
|
|
||||||
(defun project--git-submodules ()
|
(defun project--git-submodules ()
|
||||||
;; 'git submodule foreach' is much slower.
|
;; 'git submodule foreach' is much slower.
|
||||||
(condition-case nil
|
(condition-case nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue