Skip to content

paths: drop the reported-path ancestor search - #986

Open
daandemeyer wants to merge 1 commit into
notify-rs:mainfrom
daandemeyer:push-xsnkltwoqtxu
Open

paths: drop the reported-path ancestor search#986
daandemeyer wants to merge 1 commit into
notify-rs:mainfrom
daandemeyer:push-xsnkltwoqtxu

Conversation

@daandemeyer

@daandemeyer daandemeyer commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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

@JohnTitor

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

Extended the commit message a bit and added two tests to encode the current behavior

@daandemeyer

Copy link
Copy Markdown
Contributor Author

@JohnTitor Any chance you could take another look at this?

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