feat(client): ignore rule in .lodge

This commit is contained in:
hh committed 2026-10-02 21:59:27 +00:00
1 parent 4207f7e6f8
commit 45c81cfcaf
8 files changed
+146 -18

No files matched your search

+29
View File
@@ -55,6 +55,35 @@ func TestDaemonWatchesOnlyRulePaths(t *testing.T) {
}
}
func TestDaemonSkipsIgnoredPaths(t *testing.T) {
m, _ := setup(t)
watcher, err := fsnotify.NewWatcher()
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { watcher.Close() })
d := &daemon{client: m.client, watcher: watcher, owners: map[string]string{}, trees: map[string]tree{}}
write(t, m.root, RulesFile, "shared vault\nignore vault/.obsidian/workspace*.json\nignore .DS_Store\nignore vault/.trash\n")
write(t, m.root, "vault/.obsidian/app.json", "settings")
write(t, m.root, "vault/.trash/old.md", "old")
d.watch(m.root)
if _, watched := d.owners[filepath.Join(m.root, "vault/.trash")]; watched {
t.Fatal("ignored directory is watched")
}
for name, want := range map[string]bool{
"vault/note.md": true,
"vault/.obsidian/app.json": true,
"vault/.obsidian/workspace.json": false,
"vault/.obsidian/workspace-mobile.json": false,
"vault/.DS_Store": false,
"vault/.trash/old.md": false,
} {
if got := d.trees[m.root].relevant(m.root, filepath.Join(m.root, name)); got != want {
t.Errorf("relevant(%s) = %v, want %v", name, got, want)
}
}
}
func TestDaemonForgetsVanishedWorktrees(t *testing.T) {
c := &Client{DataDir: t.TempDir()}
if err := writeJSONFile(c.registryPath(), []string{filepath.Join(t.TempDir(), "gone")}); err != nil {