(fs billy.Filesystem, path string)
| 78 | } |
| 79 | |
| 80 | func loadPatterns(fs billy.Filesystem, path string) ([]MatchAttribute, error) { |
| 81 | f, err := fs.Open(path) |
| 82 | if os.IsNotExist(err) { |
| 83 | return nil, nil |
| 84 | } |
| 85 | if err != nil { |
| 86 | return nil, err |
| 87 | } |
| 88 | defer gioutil.CheckClose(f, &err) |
| 89 | |
| 90 | raw := config.New() |
| 91 | if err = config.NewDecoder(f).Decode(raw); err != nil { |
| 92 | return nil, nil |
| 93 | } |
| 94 | |
| 95 | path = raw.Section(coreSection).Options.Get(attributesfile) |
| 96 | if path == "" { |
| 97 | return nil, nil |
| 98 | } |
| 99 | |
| 100 | return ReadAttributesFile(fs, nil, path, true) |
| 101 | } |
| 102 | |
| 103 | // LoadGlobalPatterns loads gitattributes patterns and attributes from the |
| 104 | // gitattributes file declared in a user's ~/.gitconfig file. If the |
no test coverage detected