Closed vasdee closed 1 year ago
Thanks for your interest.
The problem is that ls -A1
only returns files of the current directory and not its subdirs for git check-ignore
to check. In theory you could add the --recursive
flag to the ls
command. Then git check-ignore
would also list all the ignored files of all the subdirs. But that would not really work in practice as then ls
would list all the files of the dirtree. And that can be quite a lot these days as people usually have things like python venvs or node_modules
or other build dirs with zillion files of all the dependencies of the project in their working directories. And if you feed this whole list to git check-ignore
you'd get a argument list too long
.
So ls
is no longer the right tool to use. I am not aware of a more efficient way to list all the current files that are git ignored in the whole tree. Maybe you could use the fd
tool to list the files that are not ignored and then inverse the mark in dired. But we cannot assume that fd
is present on the system, so that would be a dependency and would mean hassle for the user.
As always comments and ideas are always welcome.
Apologies about the late reply, been distracted by a great many things.
I'm actually quite intrigued by using an external tool here. Maybe ls
is the fall back but if you have something else, something like silversearcher springs to mind here, then replacing the default with ag -l
(or equivalent) is the way to go.
I already use silversearcher extensively within emacs, so at least for me, it wouldn't be a stretch to use it here
Now I'm just brain dumping here, but maybe the comparison is better against the output of git ls files
, rather than checking what is explicitly ignored?
There is a chance to get this working when we use fd
to find all the files that need to be shown (see #13). It seems to perform reasonably. Not working with dired-subtree
as of yet, though.
The problem with dired-subtree
is that (dired-goto-file)
does find files in subtrees shown by dired-subtree
. That would mean that a special mechanism would be needed in case dired-subtree
is showing something. While this is probably doable in principle, I am reluctant to implement something to accommodate 3rd party packages.
dired-subdir
aupport is added. No plans to add dired-subtree
support as of now. Feel free to reopen if you want to rediscuss or take it on.
Firstly, thanks for this package, it's a near perfect fit for my setup and as the readme states, alot less heavy than the alternatives.
I've been using
dired-gitignore
within the excellentdired-sidebar
package. One thing I've noticed there is that the use ofdired-subtree
(I assume) doesn't work well with the filtering ofdired-gitignore
. My suspicion there is that eitherdired-get-marked-files
doesn't return the files from whatdired-subtree
contains, or thatdired-gitignore
was designed for vanilla dired, in that a single folder is displayed at a time, hence the reason for the very flatgit check-ignore $(ls -A1)
check?I guess I'm not asking for a fix here, as an emacs hacking noob, just trying to gain an understanding of your approach to
dired-gitignore
and maybe any advice for me to be able to tackle this myself