]> git.eshelyaron.com Git - emacs.git/commit
project--files-in-directory: Fix handling of ignores
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 6 Sep 2021 02:01:07 +0000 (05:01 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 6 Sep 2021 02:01:07 +0000 (05:01 +0300)
commit71f8b55f46af307759fb30dcf3f784092dd8834d
tree64296711c7c120134fda17900a71cc5c3a4cd500
parent80d318aabbbf34761260104a0ddebde1ace559a6
project--files-in-directory: Fix handling of ignores

* lisp/progmodes/project.el (project--files-in-directory):
Pass "." as the DIR argument to 'find' because otherwise the ignore
expression can match the project root directory name, which we don't
want to happen (bug#50240).  Fixup the resulting file names at the end
with concatenation.
Originally I thought it could lead to worse performance, but the
results show equal or slightly better timings.

* lisp/progmodes/xref.el (xref-matches-in-directory):
Apply a similar fix.
(xref--find-ignores-arguments): Use file-name-as-directory, so
that when passed "." replace-match still had the expected effect.

* test/lisp/progmodes/project-tests.el (project-ignores-bug-50240):
New test.

* test/lisp/progmodes/xref-tests.el
(xref-matches-in-directory-filters-with-ignores): New test.
lisp/progmodes/project.el
lisp/progmodes/xref.el
test/lisp/progmodes/project-tests.el
test/lisp/progmodes/xref-tests.el