first mvp

This commit is contained in:
2026-05-16 01:39:45 +08:00
parent b3a2ae4681
commit 69afb0a53e
13 changed files with 205 additions and 272 deletions
+19
View File
@@ -0,0 +1,19 @@
package tree
import (
"os"
"path/filepath"
ignore "github.com/sabhiram/go-gitignore"
)
// Load 加载 .gitignore
func Load(root string) (*ignore.GitIgnore, error) {
path := filepath.Join(root, ".gitignore")
if _, err := os.Stat(path); os.IsNotExist(err) {
return ignore.CompileIgnoreLines(), nil
}
return ignore.CompileIgnoreFile(path)
}