+3
-6
blame.go
+3
-6
blame.go
···
107
107
b.lineToCommit[i] = needsMap[i].Commit
108
108
}
109
109
110
-
lines, err := newLines(finalLines, b.lineToCommit)
111
-
if err != nil {
112
-
return nil, err
113
-
}
110
+
lines := newLines(finalLines, b.lineToCommit)
114
111
115
112
return &BlameResult{
116
113
Path: path,
···
143
140
}
144
141
}
145
142
146
-
func newLines(contents []string, commits []*object.Commit) ([]*Line, error) {
143
+
func newLines(contents []string, commits []*object.Commit) []*Line {
147
144
result := make([]*Line, 0, len(contents))
148
145
for i := range contents {
149
146
result = append(result, newLine(
···
152
149
))
153
150
}
154
151
155
-
return result, nil
152
+
return result
156
153
}
157
154
158
155
// this struct is internally used by the blame function to hold its
+2
-4
blame_test.go
+2
-4
blame_test.go
···
22
22
23
23
func (s *BlameSuite) TestNewLines() {
24
24
h := plumbing.NewHash("ce9f123d790717599aaeb76bc62510de437761be")
25
-
lines, err := newLines([]string{"foo"}, []*object.Commit{{
25
+
lines := newLines([]string{"foo"}, []*object.Commit{{
26
26
Hash: h,
27
27
Message: "foo",
28
28
}})
29
29
30
-
s.NoError(err)
31
30
s.Len(lines, 1)
32
31
s.Equal("foo", lines[0].Text)
33
32
s.Equal(h, lines[0].Hash)
34
33
}
35
34
36
35
func (s *BlameSuite) TestNewLinesWithNewLine() {
37
-
lines, err := newLines([]string{"foo", ""}, []*object.Commit{
36
+
lines := newLines([]string{"foo", ""}, []*object.Commit{
38
37
{Message: "foo"},
39
38
{Message: "bar"},
40
39
})
41
40
42
-
s.NoError(err)
43
41
s.Len(lines, 2)
44
42
s.Equal("foo", lines[0].Text)
45
43
s.Equal("", lines[1].Text)