in internal/mode/advanced/git/gitaly.go [306:329]
func (gc *gitalyClient) gitalyBuildFile(change *pb.GetRawChangesResponse_RawChange, path string) (*File, error) {
var data io.ReadCloser
var skipTooLarge bool
// We limit the size to avoid loading too big blobs into memory
// as they will be rejected on the indexer side anyway
// Ideally, we need to create a lazy blob reader here.
if change.Size > gc.limitFileSize {
data = io.NopCloser(new(bytes.Buffer))
skipTooLarge = true
} else {
var err error
data, err = gc.getBlob(change.BlobId)
if err != nil {
return nil, fmt.Errorf("getBlob returns error: %w", err)
}
}
return &File{
Path: path,
Oid: change.BlobId,
Blob: getBlobReader(data),
SkipTooLarge: skipTooLarge,
}, nil
}