fix(client): watch only rule paths, forget vanished worktrees, ping http2
This commit is contained in:
1 parent
3b2dcffcf0
commit
4207f7e6f8
4 files changed
+165
-34
No files matched your search
@@ -61,14 +61,17 @@ func (rules Rules) paths() []string {
|
||||
func (rules Rules) covers(file string, shared bool) bool {
|
||||
best := Rule{}
|
||||
for _, rule := range rules {
|
||||
matches := file == rule.Path || strings.HasPrefix(file, rule.Path+"/")
|
||||
if matches && len(rule.Path) > len(best.Path) {
|
||||
if within(file, rule.Path) && len(rule.Path) > len(best.Path) {
|
||||
best = rule
|
||||
}
|
||||
}
|
||||
return best.Path != "" && best.Shared == shared
|
||||
}
|
||||
|
||||
func within(path, dir string) bool {
|
||||
return path == dir || strings.HasPrefix(path, dir+"/")
|
||||
}
|
||||
|
||||
func writeExclude(repo *gitrepo.Repo, rules Rules) error {
|
||||
file := filepath.Join(repo.CommonDir, "info", "exclude")
|
||||
current, _ := os.ReadFile(file)
|
||||
|
||||
Reference in new issue
Block a user