MCPcopy Create free account
hub / github.com/go-git/go-git / loadPatterns

Function loadPatterns

plumbing/format/gitattributes/dir.go:80–101  ·  view source on GitHub ↗
(fs billy.Filesystem, path string)

Source from the content-addressed store, hash-verified

78}
79
80func 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

Callers 2

LoadGlobalPatternsFunction · 0.70
LoadSystemPatternsFunction · 0.70

Calls 7

NewFunction · 0.92
NewDecoderFunction · 0.92
ReadAttributesFileFunction · 0.85
SectionMethod · 0.80
DecodeMethod · 0.65
GetMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected