Honor the VCS ignores in the watch-driven cache updates - #2139
Merged
Conversation
The last place a .gitignore was going unread. #2126 fixed it for files opened by hand, where one check-ignore per file is affordable; the watch path can be handed a whole directory that was moved in, so a process per file was not an option and the hole stayed open with a caveat in the docs. The batch is the answer: the handlers record what they added, and one check-ignore at the end of the debounce window filters the lot. That covers files discovered by directory adoption as well, which a pre-pass over the queued events would have missed. Exit status 1 from check-ignore means nothing matched, which is an answer rather than a failure - reading it as one would have made the whole thing a no-op.
It created the ignored file in a directory no watch covered, so whether an event fired for it at all was down to the backend - and on the Emacs snapshot build the whole cache had been invalidated by then, leaving nothing to assert against. Both files now land in the one directory the initial cache causes to be watched, distinguished by an ignored pattern rather than an ignored directory. The assertions are also skipped outright when the watch was dropped, which invalidates the cache and is not this spec's business.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last place a
.gitignorewas going unread. #2126 closed it for files openedby hand, where one
git check-ignoreper file is affordable. The watch pathcan't do that -
projectile--watch-adopt-directoryenumerates a whole directorythat was moved into the project, so a process per file was never an option - and
the hole stayed open with a caveat in the docs.
Batching is the answer, and where to batch turned out to be the interesting
part. A pre-pass over the queued events would miss everything found by directory
adoption, since those paths don't exist until the events are applied. So the
handlers record what they added into a batch-scoped list instead, and one
check-ignore --stdinat the end of the debounce window filters the lot. Oneprocess per 0.5s batch, no matter how many files.
Details worth knowing:
check-ignoreexits 1 when nothing matched. That's an answer, not a failure -reading it as one would have quietly made this a no-op, so there's a spec for
the all-clear case.
nativeindexing is left alone, since it lists ignored files anyway - samecall as in Don't cache an opened file the VCS ignores #2126.
call-process-regionrather than a TRAMP-aware call, because watches arenever armed for a remote project in the first place.
The integration spec creates a real repository with a
.gitignore, writes twofiles behind Emacs's back, and waits for the notification: the tracked one lands
in the cache and the ignored one doesn't.
That also lets the caveat come out of the manual and be replaced with what
actually happens.