Skip to content

Commit

Permalink
Set SkipReason when encountering large blobs in git
Browse files Browse the repository at this point in the history
Change-Id: I061ee07ce213b415f7f1e7fd99e9d0070a7d772f
  • Loading branch information
hanwen committed May 25, 2018
1 parent 8029ba6 commit fc91874
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions gitindex/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,19 +470,29 @@ func IndexGitRepo(opts Options) error {
}

if blob.Size > int64(opts.BuildOptions.SizeMax) {
if err := builder.Add(zoekt.Document{
SkipReason: fmt.Sprintf("file size %d exceeds maximum size %d", blob.Size, opts.BuildOptions.SizeMax),
Name: key.FullPath(),
Branches: brs,
SubRepositoryPath: key.SubRepoPath,
}); err != nil {
return err
}
continue
}

contents, err := blobContents(blob)
if err != nil {
return err
}
builder.Add(zoekt.Document{
if err := builder.Add(zoekt.Document{
SubRepositoryPath: key.SubRepoPath,
Name: key.FullPath(),
Content: contents,
Branches: brs,
})
}); err != nil {
return err
}
}
}
return builder.Finish()
Expand Down

0 comments on commit fc91874

Please sign in to comment.