mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
fix(sync): anchor --shared include entries to the mount root (BEA-5) (#56)
`bdrive init --shared wiki` wrote `include: ["wiki/"]`, which compile() treats as an unanchored gitignore pattern — so any nested directory named `wiki` synced too. Shared-subfolder mode is what people use to keep private material out of a project, and it was silently widening the scope: 15 files under .agents/, .claude/ and .gemini/ leaked into a real project from .../detector/shared/ dirs. cleanShared now emits "/wiki/", which fixes both callers (init --shared and bdrive scope add). config.LoadProject anchors legacy single-segment entries on read, so the existing mounts are fixed without a re-init — and that also keeps `bdrive scope rm wiki` working against pre-fix configs, with a belt-and-braces unanchored candidate key in scopeRemove for any config that bypasses LoadProject. Not touched: compile() itself, and no delete op for the already-leaked remote files (BEA-20 — a delete would unlink teammates' local copies). Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
46db6507c4
commit
056c883204
@@ -29,9 +29,13 @@ The result lands in `.bdrive/config.json` as an include list:
|
||||
|
||||
```jsonc
|
||||
{ "id": "m-5a10b713", "volume": "notes",
|
||||
"remote": "https://drive.example.com/p/p-7f3a2c91", "include": ["wiki/"] }
|
||||
"remote": "https://drive.example.com/p/p-7f3a2c91", "include": ["/wiki/"] }
|
||||
```
|
||||
|
||||
The leading slash anchors each entry to the mount root: `/wiki/` means the
|
||||
`wiki` folder at the top of this project and nothing else, so a nested
|
||||
directory that happens to share the name never syncs.
|
||||
|
||||
## Change the scope later
|
||||
|
||||
`bdrive scope` shows the include list; `scope add` / `scope rm` edit it — no
|
||||
|
||||
@@ -14,7 +14,7 @@ plus project, remote, and include settings.
|
||||
```jsonc
|
||||
// .bdrive/config.json
|
||||
{ "id": "m-5a10b713", "volume": "notes",
|
||||
"remote": "https://drive.example.com/p/p-7f3a2c91", "include": ["shared/"] }
|
||||
"remote": "https://drive.example.com/p/p-7f3a2c91", "include": ["/shared/"] }
|
||||
```
|
||||
|
||||
Written by `bdrive init` and safe to hand-edit — a running daemon picks changes
|
||||
|
||||
Reference in New Issue
Block a user