MCPcopy
hub / github.com/git-lfs/git-lfs / Applied

Method Applied

git/gitattr/tree.go:92–111  ·  view source on GitHub ↗

Applied returns a slice of attributes applied to the given path, relative to the receiving tree. It traverse through sub-trees in a topological ordering, if there are relevant .gitattributes matching that path.

(to string)

Source from the content-addressed store, hash-verified

90// the receiving tree. It traverse through sub-trees in a topological ordering,
91// if there are relevant .gitattributes matching that path.
92func (t *Tree) Applied(to string) []*Attr {
93 var attrs []*Attr
94 for _, line := range t.Lines {
95 if l, ok := line.(PatternLine); ok {
96 if l.Pattern().Match(to) {
97 attrs = append(attrs, line.Attrs()...)
98 }
99 }
100 }
101
102 splits := strings.SplitN(to, "/", 2)
103 if len(splits) == 2 {
104 car, cdr := splits[0], splits[1]
105 if child, ok := t.Children[car]; ok {
106 attrs = append(attrs, child.Applied(cdr)...)
107 }
108 }
109
110 return attrs
111}

Calls 3

MatchMethod · 0.65
PatternMethod · 0.65
AttrsMethod · 0.65