Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(filesystem): ignore dotfiles properly for find filter #1564

Conversation

obukhovaa
Copy link
Contributor

Not sure what was the purpose of that exclusion, but it was causing issues when find command is used within filter logic.

if not ignore.dotfiles then
  append("-not", "-path", "*/.*")
end

You would expect that when ignore-dotfiles is false you don't want to exclude dot files and directories. In fact it was not just excluding dot files, but all the other valid options if current path contains any . directories. For example for me the resulting command was

find  "/Users/nouwa/.config/nvim" -not -path '*/.*' -iname "*lua*"

and because my path has .config -- all files were excluded, producing empty search result.

Once this section removed, eveyrhing works as expected with both ignore.dotfiles = true and false.

@obukhovaa
Copy link
Contributor Author

Still an issue #1459, would be nice to move it forward

@cseickel
Copy link
Contributor

Sorry, I can't properly evaluate this. See #1606

@@ -193,9 +193,6 @@ M.filter_files_external = function(
if types.executable then
append("-executable")
end
if not ignore.dotfiles then
append("-not", "-path", "*/.*")
end
Copy link
Collaborator

@pynappo pynappo Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's obviously breaking but I don't know if it's necessarily redundant. Based on the code for fd, the intention seems to be to optionally exclude hidden folders and hopefully reduce the amount of lines from the external cmd that neo-tree has to process?

To get the same functionality as the 'fd' block, could you try this instead? seems to work on my end:

    -- right after `for k, v in pairs(types) do ... end`
    if ignore.dotfiles then
      append("-name", ".*", "-prune", "-o")
    end
    -- right before the call to append_find_args:
    -- explicitly print out entries since `-prune -o` may expect an expression after it
    append("-print")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I've tested with both enabled/disabled setting, works well so far

@obukhovaa
Copy link
Contributor Author

I've pushed the suggested improvement on top of the original fix, tested a few direct cases, didn't find any issues so far, so I think we good.

@pynappo pynappo changed the title fix(filesystem): remove redundant exclusion breaking filter for find (#1459) fix(filesystem): ignore dotfiles properly for find filter Jan 18, 2025
@pynappo pynappo merged commit f7801ec into nvim-neo-tree:main Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants