feat(client): ignore rule in .lodge
This commit is contained in:
1 parent
4207f7e6f8
commit
45c81cfcaf
8 files changed
+146
-18
No files matched your search
@@ -112,8 +112,8 @@ func (t tree) relevant(root, name string) bool {
|
||||
return false
|
||||
}
|
||||
rel = filepath.ToSlash(rel)
|
||||
return slices.ContainsFunc(t.rules, func(rule Rule) bool {
|
||||
return within(rel, rule.Path) || within(rule.Path, rel)
|
||||
return !t.rules.ignored(rel) && slices.ContainsFunc(t.rules, func(rule Rule) bool {
|
||||
return !rule.Ignore && (within(rel, rule.Path) || within(rule.Path, rel))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -178,14 +178,15 @@ func (d *daemon) watch(root string) {
|
||||
}
|
||||
rules := LoadRules(repo.Root)
|
||||
dirs := map[string]bool{repo.GitDir: true}
|
||||
for _, rule := range rules {
|
||||
for _, rule := range rules.synced() {
|
||||
target := filepath.Join(repo.Root, filepath.FromSlash(rule.Path))
|
||||
dirs[nearestDir(filepath.Dir(target), repo.Root)] = true
|
||||
_ = filepath.WalkDir(target, func(path string, entry fs.DirEntry, err error) error {
|
||||
if err != nil || !entry.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if entry.Name() == ".git" {
|
||||
rel, _ := filepath.Rel(repo.Root, path)
|
||||
if entry.Name() == ".git" || rules.ignored(filepath.ToSlash(rel)) {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
dirs[path] = true
|
||||
|
||||
Reference in new issue
Block a user