-
Notifications
You must be signed in to change notification settings - Fork 107
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
exclude .git folder returns a null tree #71
Comments
Quick follow up, just tested by excluding a 'git' folder (no ' . ' prefix)
and again I get:
Is the phrase 'git' somehow a reserved word in the codebase? |
Hi! What is the full path of the folder you are testing? |
Thanks for looking into this. Edit: some clarification on the folder structure.
And I'm trying to run the directory tree on path: /usr/project |
After some more thought, could it be that '.git' is the first folder in the directory and the exclusion /.git/ trips the if statement on line 63 and it returns null and never goes further in the folder? I can exclude /node_modules/ without a problem and that works as expected. |
Sorry, shouldn't |
I'm on macOs, node v12, directory-tree v2.2.4...
When I try to create a directory tree by excluding the .git folder:
const tree = dirTree(rootPath, { exclude: [/.git/] }); console.log('tree is ', tree)
I get:
tree is null
But when I specify an absolute path to the .git folder:
const tree = dirTree(rootPath, { exclude: [/\/absolute-path-to-folder\/.git/] }); console.log('tree is ', tree)
I get:
tree is Object{...}
I'd like to exclude all .git folders (without having to specify the absolute path to them).
Has anyone else encountered this? Am I using exclude incorrectly (exclude does work as expected on any other folders starting with ' . ' just not '.git')?
The text was updated successfully, but these errors were encountered: