[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50240: 28.0.50; incorrect handling of ignore files in project-files
From: |
Dmitry Gutov |
Subject: |
bug#50240: 28.0.50; incorrect handling of ignore files in project-files |
Date: |
Sun, 29 Aug 2021 04:17:11 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
Hi!
On 28.08.2021 19:52, Omar Polo wrote:
Hello,
I'm working on a custom VC backend and noticed something strange
regarding the handling of ignore files in project-files: ignoring a file
that has the same name of the project makes project-files return nil.
To reproduce:
1. create a directory structure as follows:
mkdir /tmp/foo
touch /tmp/foo/{foo,bar}
2. define a trivial project:
(cl-defmethod project-roots ((_ (eql foo)))
'("/tmp/foo/"))
(cl-defmethod project-ignores ((_ (eql foo)) _)
'("foo"))
3. invoke project-files
(project-files 'foo)
;; => nil
This is because project--files-in-directory directory-file-name. The
find command build is
find -H /tmp/foo \( -path \*/foo \) -prune -o -type f -print0
and no files are found because are all pruned.
It might be doing the correct thing, depending on how we define the
exact semantics of ignores. I guess it will really depend on how this is
going to be to fix without breaking the previous advancements. ;-)
Try returning "./foo" instead of "foo". Would that work for you? Or does
your usage require a more general fix?
If I edit project--files-in-directory to use file-name-as-directory,
then the command becomes
find -H /tmp/foo/ \( -path \*/foo \) -prune -o -type f -print0
# note the final slash!
and project-files successfully returns the files
(project-files 'foo)
;; => ("/tmp/foo/bar")
From what I see, project.el used to call file-name-as-directory, but was
changed to directory-file-name due to bug#48471 (which I can't reproduce
with OpenBSD find.)
Yeah, for all I know it only happens with 'find' distributed with macOS.
Which is unfortunate, since it's a relatively popular OS.
NB: This is can't be reproduced using a vc-git or vc-hg backed project
because project-files treats those backend specially.
Correct.