Debian Codegraph @

git/gitattr/attr.go

raw symbols SCIP
1 package gitattrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/
2
3 import (
4 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
5 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
6 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
7 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
8 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
9
10 "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
11 "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/"
12 "github.com/git-lfs/wildmatch/v2scip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/"
13 )
14
15 const attrPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/attrPrefix. = "[attr]"
16
17 type Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line# interface {
18 Attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#Attrs.() []*Attrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#
19 }
20
21 type PatternLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/PatternLine# interface {
22 Patternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/PatternLine#Pattern.() *wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.Wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/Wildmatch#
23 Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#
24 }
25
26 type MacroLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/MacroLine# interface {
27 Macroscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/MacroLine#Macro.() string
28 Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#
29 }
30
31 type lineAttrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs# struct {
32 // Attrs is the list of attributes defined in a .gitattributes line.
33 //
34 // It is populated in-order as it was written in the .gitattributes file
35 // being read, from left to right.
36 attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#attrs. []*Attrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#
37 }
38
39 func (l *lineAttrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#) Attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#Attrs().() []*Attrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr# {
40 return l.attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#attrs.
41 }
42
43 type patternLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine# struct {
44 // Pattern is a wildmatch pattern that, when matched, indicates that all
45 // of the below attributes (Attrs) should be applied to that tree entry.
46 //
47 // Pattern is relative to the tree in which the .gitattributes was read
48 // from. For example, /.gitattributes affects all blobs in the
49 // repository, while /path/to/.gitattributes affects all blobs that are
50 // direct or indirect children of /path/to.
51 patternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#pattern. *wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.Wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/Wildmatch#
52 // Attrs is the list of attributes to be applied when the above pattern
53 // matches a given filename.
54 lineAttrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#lineAttrs.
55 }
56
57 func (pl *patternLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#) Patternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#Pattern().() *wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.Wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/Wildmatch# {
58 return pl.patternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#pattern.
59 }
60
61 type macroLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine# struct {
62 // Macro is the name of a macro that, when matched, indicates that all
63 // of the below attributes (Attrs) should be applied to that tree
64 // entry.
65 macroscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#macro. string
66 // Attrs is the list of attributes to be applied when the above macro
67 // name is matched for a given filename.
68 lineAttrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#lineAttrs.
69 }
70
71 func (ml *macroLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#) Macroscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#Macro().() string {
72 return ml.macroscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#macro.
73 }
74
75 // Attr is a single attribute that may be applied to a file.
76 type Attrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr# struct {
77 // K is the name of the attribute. It is commonly, "filter", "diff",
78 // "merge", or "text".
79 //
80 // It will never contain the special "false" shorthand ("-"), or the
81 // unspecify declarative ("!").
82 Kscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#K. string
83 // V is the value held by that attribute. It is commonly "lfs", or
84 // "false", indicating the special value given by a "-"-prefixed name.
85 Vscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#V. string
86 // Unspecified indicates whether or not this attribute was explicitly
87 // unset by prefixing the keyname with "!".
88 Unspecifiedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#Unspecified. bool
89 }
90
91 // ParseLines parses the given io.Reader "r" line-wise as if it were the
92 // contents of a .gitattributes file.
93 //
94 // If an error was encountered, it will be returned and the []*Line should be
95 // considered unusable.
96 func ParseLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/ParseLines().(r ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Readerscip-go gomod github.com/golang/go/src go1.25.0 io/Reader#) ([]Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#, string, error) {
97 var lines []Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#
98
99 splitter := &lineEndingSplitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#{}
100
101 scanner := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewScannerscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewScanner().(r)
102 scanner.Splitscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Split().(splitter.ScanLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#ScanLines().)
103 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
104 text := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().())
105 if len(text) == 0 {
106 continue
107 }
108
109 var pattern string
110 var applied string
111 var macro string
112
113 switch text[0] {
114 case '#':
115 continue
116 case '"':
117 var err error
118 last := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.LastIndexscip-go gomod github.com/golang/go/src go1.25.0 strings/LastIndex().(text, "\"")
119 if last == 0 {
120 return nil, "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("unbalanced quote: %s", text))
121 }
122 pattern, err = strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Unquotescip-go gomod github.com/golang/go/src go1.25.0 strconv/Unquote().(text[:last+1])
123 if err != nil {
124 return nil, "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("unable to unquote: %s", text[:last+1]))
125 }
126 applied = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(text[last+1:])
127 default:
128 splits := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(text, " ", 2)
129
130 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(splits[0], attrPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/attrPrefix.) {
131 macro = splits[0][len(attrPrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/attrPrefix.):]
132 } else {
133 pattern = splits[0]
134 }
135 if len(splits) == 2 {
136 applied = splits[1]
137 }
138 }
139
140 var lineAttrs lineAttrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#
141
142 for _, s := range stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(applied, " ") {
143 if s == "" {
144 continue
145 }
146
147 var attr Attrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#
148
149 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(s, "-") {
150 attr.Kscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#K. = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(s, "-")
151 attr.Vscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#V. = "false"
152 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(s, "!") {
153 attr.Kscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#K. = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(s, "!")
154 attr.Unspecifiedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#Unspecified. = true
155 } else if eq := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Indexscip-go gomod github.com/golang/go/src go1.25.0 strings/Index().(s, "="); eq > -1 {
156 attr.Kscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#K. = s[:eq]
157 attr.Vscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#V. = s[eq+1:]
158 } else {
159 attr.Kscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#K. = s
160 attr.Vscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Attr#V. = "true"
161 }
162
163 lineAttrs.attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#attrs. = append(lineAttrs.attrsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineAttrs#attrs., &attr)
164 }
165
166 var line Linescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/Line#
167 if pattern != "" {
168 matchPattern, err := newPatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/newPattern().(pattern)
169 if err != nil {
170 return nil, "", err
171 }
172 line = &patternLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/patternLine#{matchPattern, lineAttrs}
173 } else {
174 line = &macroLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/macroLine#{macro, lineAttrs}
175 }
176
177 lines = append(lines, line)
178 }
179
180 if err := scanner.Errscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Err().(); err != nil {
181 return nil, "", err
182 }
183 return lines, splitter.LineEndingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LineEnding().(), nil
184 }
185
186 func newPatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/newPattern().(pattern string) (matchPattern *wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.Wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/Wildmatch#, err error) {
187 defer func() {
188 if recovered := recover(); recovered != nil {
189 err = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("invalid attribute pattern %q: %v", pattern, recovered))
190 }
191 }()
192
193 return wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.NewWildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/NewWildmatch().(pattern,
194 wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.Basenamescip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/Basename., wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.SystemCasescip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/SystemCase.,
195 wildmatchscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/.GitAttributesscip-go gomod github.com/git-lfs/wildmatch/v2 v2.0.1 `github.com/git-lfs/wildmatch/v2`/GitAttributes.,
196 ), nil
197 }
198
199 // copies bufio.ScanLines(), counting LF vs CRLF in a file
200 type lineEndingSplitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter# struct {
201 LFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LFCount. int
202 CRLFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#CRLFCount. int
203 }
204
205 func (s *lineEndingSplitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#) LineEndingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LineEnding().() string {
206 if s.CRLFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#CRLFCount. > s.LFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LFCount. {
207 return "\r\n"
208 } else if s.LFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LFCount. == 0 {
209 return ""
210 }
211 return "\n"
212 }
213
214 func (s *lineEndingSplitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#) ScanLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#ScanLines().(data []byte, atEOF bool) (advance int, token []byte, err error) {
215 if atEOF && len(data) == 0 {
216 return 0, nil, nil
217 }
218 if i := bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.IndexBytescip-go gomod github.com/golang/go/src go1.25.0 bytes/IndexByte().(data, '\n'); i >= 0 {
219 // We have a full newline-terminated line.
220 return i + 1, s.dropCRscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#dropCR().(data[0:i]), nil
221 }
222 // If we're at EOF, we have a final, non-terminated line. Return it.
223 if atEOF {
224 return len(data), data, nil
225 }
226 // Request more data.
227 return 0, nil, nil
228 }
229
230 // dropCR drops a terminal \r from the data.
231 func (s *lineEndingSplitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#) dropCRscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#dropCR().(data []byte) []byte {
232 if len(data) > 0 && data[len(data)-1] == '\r' {
233 s.CRLFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#CRLFCount.++
234 return data[0 : len(data)-1]
235 }
236 s.LFCountscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/lineEndingSplitter#LFCount.++
237 return data
238 }