@@ -2,6 +2,9 @@ package function
22
33import (
44 "fmt"
5+ "io"
6+
7+ "github.com/sirupsen/logrus"
58
69 "github.com/src-d/gitbase"
710 "github.com/src-d/go-mysql-server/sql"
@@ -17,10 +20,11 @@ type BlameGenerator struct {
1720 curLine int
1821 curFile * object.File
1922 lines []* git.Line
23+ ctx * sql.Context
2024}
2125
22- func NewBlameGenerator (c * object.Commit , f * object.FileIter ) (* BlameGenerator , error ) {
23- return & BlameGenerator {commit : c , fIter : f , curLine : - 1 }, nil
26+ func NewBlameGenerator (c * object.Commit , f * object.FileIter , ctx * sql. Context ) (* BlameGenerator , error ) {
27+ return & BlameGenerator {commit : c , fIter : f , curLine : - 1 , ctx : ctx }, nil
2428}
2529
2630func (g * BlameGenerator ) loadNewFile () error {
@@ -32,7 +36,11 @@ func (g *BlameGenerator) loadNewFile() error {
3236
3337 result , err := git .Blame (g .commit , g .curFile .Name )
3438 if err != nil {
35- return err
39+ msg := fmt .Sprintf ("Error in BLAME for file %s: %s" ,
40+ g .curFile .Name , err .Error ())
41+ logrus .Warn (msg )
42+ g .ctx .Warn (0 , msg )
43+ return io .EOF
3644 }
3745
3846 if len (result .Lines ) == 0 {
@@ -145,7 +153,7 @@ func (b *Blame) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
145153 return nil , err
146154 }
147155
148- bg , err := NewBlameGenerator (commit , fIter )
156+ bg , err := NewBlameGenerator (commit , fIter , ctx )
149157 if err != nil {
150158 return nil , err
151159 }
0 commit comments