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

feat: Do not visit Git-ignored files #309

Merged
merged 2 commits into from
Dec 22, 2022

Conversation

spdawson
Copy link
Contributor

@spdawson spdawson commented Dec 21, 2022

Description

When possible, obtain the list of files to be scanned by means of git ls-files. This will automatically exclude files that are covered by the Git ignore file, so that we no longer need even visit these as we walk over the scanned directory tree.

Note that, as well as excluding Git-ignored files, this also has the benefit that we will no longer process any files under the .git directory parent; this will typically be thousands of files that we can avoid a stat on.

Closes #280

Checklist

  • I've added test coverage that shows my fix or feature works as expected.
  • I've updated or added documentation if required.
  • I've included usage information in the description if CLI behavior was updated or added.
  • PR title follows Conventional Commits format

@cfabianski
Copy link
Collaborator

@spdawson FYI it also scans the .git folder

@spdawson
Copy link
Contributor Author

@spdawson FYI it also scans the .git folder

Yes, I had seen this in the course of my initial investigation — potentially a lot of files being unnecessarily examined 😬

@spdawson spdawson force-pushed the fix/do-not-visit-Git-ignored-files branch 2 times, most recently from 5944999 to 7ce4065 Compare December 22, 2022 08:25
@spdawson spdawson requested a review from vjerci December 22, 2022 08:26
@spdawson spdawson marked this pull request as ready for review December 22, 2022 08:27
spdawson and others added 2 commits December 22, 2022 10:52
When possible, obtain the list of files to be scanned by
means of `git ls-files`. This will automatically exclude files
that are covered by the Git ignore file, so that we no longer
need even visit these as we walk over the scanned directory tree.

Closes #280
Co-authored-by: Cédric Fabianski <cedric@bearer.sh>
@spdawson spdawson force-pushed the fix/do-not-visit-Git-ignored-files branch from 817a781 to 05b6d5d Compare December 22, 2022 10:52
@spdawson spdawson merged commit 06558b3 into main Dec 22, 2022
@spdawson spdawson deleted the fix/do-not-visit-Git-ignored-files branch December 22, 2022 14:04
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.

Ignored git folders/file are scanned while it shouldn't
2 participants