-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
porcelain.status: skip traversal of gitignore untracked dirs #853
Conversation
Codecov Report
@@ Coverage Diff @@
## master #853 +/- ##
==========================================
+ Coverage 84.67% 84.69% +0.01%
==========================================
Files 90 90
Lines 22019 22047 +28
Branches 2354 2358 +4
==========================================
+ Hits 18645 18673 +28
Misses 2961 2961
Partials 413 413
Continue to review full report at Codecov.
|
porcelain.add could probably also benefit from this? Although the current behavior is to return the tuple of |
The changes look good - any chance you could add a test to make sure this doesn't regress? |
I think it would make sense to change the behaviour of add as well - we should make sure to document the change in behaviour in NEWS. |
f601f65
to
e336d39
Compare
"ignored", | ||
os.path.join("subdir", ""), | ||
] | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should catch any future regression, if we recurse into the ignored subdir
here, we will end up yielding subdir/ignored
as well.
- otherwise ignored files will still be processed
e336d39
to
24ec0da
Compare
@jelmer this is also ready for review |
When using
porcelain.get_untracked_paths
withexclude_ignored
, currently every untracked path is checked to see if it is gitignored. If a directory is gitignored, we can skip checking the remainder of the files inside that directory - from the documentation for gitignore:Changes after this PR:
porcelain.get_untracked_files
: no longer walks ignored directories for performance reasons. The path to the ignored dir (including trailing slash) will be yielded ifexclude_ignored=False
, but individual files within the directory will not be included.porcelain.add
: now only returns path to ignored directory in the (added
,ignored
) tuple (previously all files inside ignored dirs would be returned)porcelain.status
: now only returns path to ignored directory when called withignored=True
(previously all files inside ignored dirs would be returned)