Files
cliprepo/internal/gitignore/ignore.go
T
2026-05-15 23:36:12 +08:00

18 lines
330 B
Go

package gitignore
import (
"os"
"path/filepath"
ignore "github.com/sabhiram/go-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)
}