(fileSystem afero.Fs, path string)
| 94 | } |
| 95 | |
| 96 | func loadPatterns(fileSystem afero.Fs, path string) ([]gitignore.Pattern, error) { |
| 97 | data, err := afero.ReadFile(fileSystem, path) |
| 98 | if err != nil && !errors.Is(err, os.ErrNotExist) { |
| 99 | return nil, err |
| 100 | } |
| 101 | |
| 102 | decoder := config.NewDecoder(bytes.NewBuffer(data)) |
| 103 | |
| 104 | conf := config.New() |
| 105 | if err := decoder.Decode(conf); err != nil { |
| 106 | return nil, xerrors.Errorf("decode config: %w", err) |
| 107 | } |
| 108 | |
| 109 | excludes := conf.Section("core").Options.Get("excludesfile") |
| 110 | if excludes == "" { |
| 111 | return nil, nil |
| 112 | } |
| 113 | |
| 114 | return readIgnoreFile(fileSystem, "", excludes) |
| 115 | } |
| 116 | |
| 117 | func LoadGlobalPatterns(fileSystem afero.Fs) ([]gitignore.Pattern, error) { |
| 118 | home, err := os.UserHomeDir() |
no test coverage detected