paths: drop the reported-path ancestor search - #986
Open
daandemeyer wants to merge 1 commit into
Open
Conversation
Member
|
I intentionally added this, I might misundertstand something, let me dive deep. |
If you watch "logs", you hear about "logs/app.txt", not the absolute path. A recursive watch adds one watch per directory below it, and the walker already knows what each should be called, so it works that out and passes it in. But WatchMetadata::new ignored that information and instead searched every watch it received from the caller for the nearest recursive one above the entry. The two differ only when one place is watched twice under different spellings, one nested in the other: from /home/me/project, watch "logs", then "/home/me/project". The search calls logs/access "logs/access", the walker calls it "/home/me/project/logs/access". Prefer the walker spelling, which names the watch that just created the entry. "logs" was asked for by name so it keeps its spelling, leaving one subtree with two names, but there was never a guarantee for overlapping watches that were spelled differently. Tests are added to encode the current behavior. Drop the user_roots argument since it's not required anymore. Signed-off-by: Daan De Meyer <daan@amutable.com>
daandemeyer
force-pushed
the
push-xsnkltwoqtxu
branch
from
August 21, 2026 09:10
5fdfdf2 to
88773fb
Compare
Contributor
Author
|
Extended the commit message a bit and added two tests to encode the current behavior |
Contributor
Author
|
@JohnTitor Any chance you could take another look at this? |
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.
A watch remembers what to call its path in events: watch "logs" and you
hear about "logs/app.txt", not the absolute path. A recursive watch adds
one watch per directory below it, and the walker already knows what each
should be called, so it works that out and passes it in.
WatchMetadata::new ignored that and searched every watch we hold for the
nearest recursive one above the entry to derive the same answer again.
The two differ only when one place is watched twice under different
spellings, one nested in the other: from /home/me/project, watch "logs",
then "/home/me/project". The search calls logs/access "logs/access", the
walker "/home/me/project/logs/access". Take the walker, which names the
watch that just created the entry. "logs" was asked for by name so it
keeps its spelling, leaving one subtree with two names, but overlapping
watches spelled differently have never had a promised answer.
outer_recursive_watch_respells_inherited_entries_only pins it on both
backends.
user_roots and its generic bound go with the search, and the single
condition left collapses to a match.
Signed-off-by: Daan De Meyer daan@amutable.com