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

Set glob's :hidden when pattern starts with dot #114

Closed
wants to merge 1 commit into from

Conversation

eval
Copy link
Contributor

@eval eval commented Sep 26, 2023

So this would e.g. find ~/.gitconfig: (fs/glob (home) ".git*")

Issue: #113

Please answer the following questions and leave the below in as part of your PR.

(str/includes? pattern "/"))))]
(match root (str "glob:" pattern) (assoc opts :recursive recursive)))))
(str/includes? pattern "/"))))
hidden (:hidden opts (when-not win? (str/starts-with? pattern ".")))]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say let's also do this for Windows, unless the hidden option is explicitly set?

Copy link
Contributor Author

@eval eval Sep 26, 2023

Choose a reason for hiding this comment

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

Yeah that makes sense I think.

I didn't do it as what I understood from glob's docstring is that being 'dotted' and 'hidden' are orthogonal things on Windows.
So .git* already finds .gitignore and it can't be concluded from a dot-pattern that hidden files should be considered - but in the end we only add dotfiles that are hidden to the haystack.

Will amend it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added, re-ran API generation and added some formatting to docstrings.

So this would e.g. find ~/.gitconfig: `(fs/glob (home) ".git*")`
@@ -100,7 +100,12 @@
sym-link (fs/create-sym-link (fs/file tmp-dir2 "sym-link") tmp-dir1)]
(is (empty? (fs/glob sym-link "**")))
(is (= 1 (count (fs/glob sym-link "**" {:follow-links true}))))
(is (= 1 (count (fs/glob (fs/real-path sym-link) "**")))))))
(is (= 1 (count (fs/glob (fs/real-path sym-link) "**"))))))
(testing ":hidden option"
Copy link
Contributor Author

@eval eval Sep 26, 2023

Choose a reason for hiding this comment

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

I kept this test non-Windows as the extra hassle to set a hidden attribute seems not worth it.

@borkdude
Copy link
Contributor

borkdude commented Oct 7, 2023

Merged with minor changes on master

@borkdude borkdude closed this Oct 7, 2023
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.

2 participants