@@ -6,6 +6,7 @@ package git
66
77import (
88 "bytes"
9+ "context"
910 "encoding/base64"
1011 "errors"
1112 "io"
@@ -22,11 +23,11 @@ func (b *Blob) Name() string {
2223}
2324
2425// GetBlobContent Gets the limited content of the blob as raw text
25- func (b * Blob ) GetBlobContent (limit int64 ) (string , error ) {
26+ func (b * Blob ) GetBlobContent (ctx context. Context , limit int64 ) (string , error ) {
2627 if limit <= 0 {
2728 return "" , nil
2829 }
29- dataRc , err := b .DataAsync ()
30+ dataRc , err := b .DataAsync (ctx )
3031 if err != nil {
3132 return "" , err
3233 }
@@ -37,8 +38,8 @@ func (b *Blob) GetBlobContent(limit int64) (string, error) {
3738
3839// GetBlobLineCount gets line count of the blob.
3940// It will also try to write the content to w if it's not nil, then we could pre-fetch the content without reading it again.
40- func (b * Blob ) GetBlobLineCount (w io.Writer ) (int , error ) {
41- reader , err := b .DataAsync ()
41+ func (b * Blob ) GetBlobLineCount (ctx context. Context , w io.Writer ) (int , error ) {
42+ reader , err := b .DataAsync (ctx )
4243 if err != nil {
4344 return 0 , err
4445 }
@@ -64,8 +65,8 @@ func (b *Blob) GetBlobLineCount(w io.Writer) (int, error) {
6465}
6566
6667// GetBlobContentBase64 Reads the content of the blob with a base64 encode and returns the encoded string
67- func (b * Blob ) GetBlobContentBase64 () (string , error ) {
68- dataRc , err := b .DataAsync ()
68+ func (b * Blob ) GetBlobContentBase64 (ctx context. Context ) (string , error ) {
69+ dataRc , err := b .DataAsync (ctx )
6970 if err != nil {
7071 return "" , err
7172 }
@@ -93,8 +94,8 @@ func (b *Blob) GetBlobContentBase64() (string, error) {
9394}
9495
9596// GuessContentType guesses the content type of the blob.
96- func (b * Blob ) GuessContentType () (typesniffer.SniffedType , error ) {
97- r , err := b .DataAsync ()
97+ func (b * Blob ) GuessContentType (ctx context. Context ) (typesniffer.SniffedType , error ) {
98+ r , err := b .DataAsync (ctx )
9899 if err != nil {
99100 return typesniffer.SniffedType {}, err
100101 }
0 commit comments