diff options
| author | Dmitry Gutov | 2020-06-18 01:30:32 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2020-06-18 01:30:32 +0300 |
| commit | 2cc48d3d10a7a0e3ced644c75972e2af2364e68b (patch) | |
| tree | 08e268a28fb2ba5041e9e4ca25661e7e1e0e4816 | |
| parent | e2f443df17710c74fa6a2e51dd061f7e898d48e6 (diff) | |
| download | emacs-2cc48d3d10a7a0e3ced644c75972e2af2364e68b.tar.gz emacs-2cc48d3d10a7a0e3ced644c75972e2af2364e68b.zip | |
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.
| -rw-r--r-- | lisp/progmodes/project.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 0921922f5d8..1c1891fcf55 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -306,7 +306,7 @@ backend implementation of `project-external-roots'.") | |||
| 306 | (if (and | 306 | (if (and |
| 307 | ;; FIXME: Invalidate the cache when the value | 307 | ;; FIXME: Invalidate the cache when the value |
| 308 | ;; of this variable changes. | 308 | ;; of this variable changes. |
| 309 | project-vc-merge-submodules | 309 | (project--vc-merge-submodules-p root) |
| 310 | (project--submodule-p root)) | 310 | (project--submodule-p root)) |
| 311 | (let* ((parent (file-name-directory | 311 | (let* ((parent (file-name-directory |
| 312 | (directory-file-name root)))) | 312 | (directory-file-name root)))) |
| @@ -396,19 +396,20 @@ backend implementation of `project-external-roots'.") | |||
| 396 | (split-string | 396 | (split-string |
| 397 | (apply #'vc-git--run-command-string nil "ls-files" args) | 397 | (apply #'vc-git--run-command-string nil "ls-files" args) |
| 398 | "\0" t))) | 398 | "\0" t))) |
| 399 | ;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'. | 399 | (when (project--vc-merge-submodules-p default-directory) |
| 400 | (let* ((submodules (project--git-submodules)) | 400 | ;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'. |
| 401 | (sub-files | 401 | (let* ((submodules (project--git-submodules)) |
| 402 | (mapcar | 402 | (sub-files |
| 403 | (lambda (module) | 403 | (mapcar |
| 404 | (when (file-directory-p module) | 404 | (lambda (module) |
| 405 | (project--vc-list-files | 405 | (when (file-directory-p module) |
| 406 | (concat default-directory module) | 406 | (project--vc-list-files |
| 407 | backend | 407 | (concat default-directory module) |
| 408 | extra-ignores))) | 408 | backend |
| 409 | submodules))) | 409 | extra-ignores))) |
| 410 | (setq files | 410 | submodules))) |
| 411 | (apply #'nconc files sub-files))) | 411 | (setq files |
| 412 | (apply #'nconc files sub-files)))) | ||
| 412 | ;; 'git ls-files' returns duplicate entries for merge conflicts. | 413 | ;; 'git ls-files' returns duplicate entries for merge conflicts. |
| 413 | ;; XXX: Better solutions welcome, but this seems cheap enough. | 414 | ;; XXX: Better solutions welcome, but this seems cheap enough. |
| 414 | (delete-consecutive-dups files))) | 415 | (delete-consecutive-dups files))) |
| @@ -429,6 +430,11 @@ backend implementation of `project-external-roots'.") | |||
| 429 | (lambda (s) (concat default-directory s)) | 430 | (lambda (s) (concat default-directory s)) |
| 430 | (split-string (buffer-string) "\0" t))))))) | 431 | (split-string (buffer-string) "\0" t))))))) |
| 431 | 432 | ||
| 433 | (defun project--vc-merge-submodules-p (dir) | ||
| 434 | (project--value-in-dir | ||
| 435 | 'project-vc-merge-submodules | ||
| 436 | dir)) | ||
| 437 | |||
| 432 | (defun project--git-submodules () | 438 | (defun project--git-submodules () |
| 433 | ;; 'git submodule foreach' is much slower. | 439 | ;; 'git submodule foreach' is much slower. |
| 434 | (condition-case nil | 440 | (condition-case nil |