@@ -2,6 +2,9 @@ package function
2
2
3
3
import (
4
4
"fmt"
5
+ "io"
6
+
7
+ "github.com/sirupsen/logrus"
5
8
6
9
"github.com/src-d/gitbase"
7
10
"github.com/src-d/go-mysql-server/sql"
@@ -12,15 +15,16 @@ import (
12
15
)
13
16
14
17
type BlameGenerator struct {
18
+ ctx * sql.Context
15
19
commit * object.Commit
16
20
fIter * object.FileIter
17
21
curLine int
18
22
curFile * object.File
19
23
lines []* git.Line
20
24
}
21
25
22
- func NewBlameGenerator (c * object.Commit , f * object.FileIter ) (* BlameGenerator , error ) {
23
- return & BlameGenerator {commit : c , fIter : f , curLine : - 1 }, nil
26
+ func NewBlameGenerator (ctx * sql. Context , c * object.Commit , f * object.FileIter ) (* BlameGenerator , error ) {
27
+ return & BlameGenerator {ctx : ctx , commit : c , fIter : f , curLine : - 1 }, nil
24
28
}
25
29
26
30
func (g * BlameGenerator ) loadNewFile () error {
@@ -32,7 +36,14 @@ func (g *BlameGenerator) loadNewFile() error {
32
36
33
37
result , err := git .Blame (g .commit , g .curFile .Name )
34
38
if err != nil {
35
- return err
39
+ msg := fmt .Sprintf (
40
+ "Error in BLAME for file %s: %s" ,
41
+ g .curFile .Name ,
42
+ err .Error (),
43
+ )
44
+ logrus .Warn (msg )
45
+ g .ctx .Warn (0 , msg )
46
+ return io .EOF
36
47
}
37
48
38
49
if len (result .Lines ) == 0 {
@@ -145,7 +156,7 @@ func (b *Blame) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
145
156
return nil , err
146
157
}
147
158
148
- bg , err := NewBlameGenerator (commit , fIter )
159
+ bg , err := NewBlameGenerator (ctx , commit , fIter )
149
160
if err != nil {
150
161
return nil , err
151
162
}
0 commit comments