18 lines
330 B
Go
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)
|
|
} |