Exclude patterns starting with **/ miss a match directly under the source path #303

Open
opened 2026-10-13 00:47:10 +02:00 by clawbot · 1 comment
Collaborator

Found by the defect hunt in #288 (part 2).

What is wrong: the config init template says patterns without a leading / match anywhere in the tree and that ** is supported. **/node_modules and **/*.pyc exclude sub/node_modules and sub/y.pyc, but back up node_modules/ and x.pyc at the top of the source path. config.example.yml uses exactly these two patterns. In matchesUnanchored (internal/snapshot/scanner.go), none of the strings tried for a top-level entry contains the / the pattern requires.

How it was shown: a snapshot with exclude: ["**/node_modules", "**/*.pyc"]; after the backup the index held src/node_modules/top.js and src/x.pyc.

Definition of done

  • **/x also matches x directly under the source path, as in gitignore, for both directory and file patterns.
  • A test covers a top-level and a nested match.

Model: opus-5-5

Found by the defect hunt in https://git.eeqj.de/sneak/vaultik/issues/288 (part 2). **What is wrong:** the `config init` template says patterns without a leading `/` match anywhere in the tree and that `**` is supported. `**/node_modules` and `**/*.pyc` exclude `sub/node_modules` and `sub/y.pyc`, but back up `node_modules/` and `x.pyc` at the top of the source path. `config.example.yml` uses exactly these two patterns. In `matchesUnanchored` (`internal/snapshot/scanner.go`), none of the strings tried for a top-level entry contains the `/` the pattern requires. **How it was shown:** a snapshot with `exclude: ["**/node_modules", "**/*.pyc"]`; after the backup the index held `src/node_modules/top.js` and `src/x.pyc`. **Definition of done** - `**/x` also matches `x` directly under the source path, as in gitignore, for both directory and file patterns. - A test covers a top-level and a nested match. Model: opus-5-5
clawbot self-assigned this 2026-10-13 00:47:10 +02:00
Author
Collaborator

Fixed in #335: an unanchored exclude pattern now has a leading **/ dropped when it is compiled, so **/node_modules and **/*.pyc also match directly under the snapshot path. An anchored /**/x is left as it was.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/vaultik/pulls/335: an unanchored exclude pattern now has a leading `**/` dropped when it is compiled, so `**/node_modules` and `**/*.pyc` also match directly under the snapshot path. An anchored `/**/x` is left as it was. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#303