File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
package git
6
6
7
+ import "time"
8
+
9
+ // CatFileBlobOptions contains optional arguments for verifying the objects.
10
+ //
11
+ // Docs: https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt
12
+ type CatFileBlobOptions struct {
13
+ // The timeout duration before giving up for each shell command execution.
14
+ // The default timeout duration will be used when not supplied.
15
+ Timeout time.Duration
16
+ // The additional options to be passed to the underlying git.
17
+ CommandOptions
18
+ }
19
+
7
20
// CatFileBlob returns the blob corresponding to the given revision of the repository.
8
- func (r * Repository ) CatFileBlob (rev string ) (* Blob , error ) {
21
+ func (r * Repository ) CatFileBlob (rev string , opts ... CatFileBlobOptions ) (* Blob , error ) {
22
+ var opt CatFileBlobOptions
23
+ if len (opts ) > 0 {
24
+ opt = opts [0 ]
25
+ }
26
+
9
27
rev , err := r .RevParse (rev , RevParseOptions {Timeout : opt .Timeout }) //nolint
10
28
if err != nil {
11
29
return nil , err
You can’t perform that action at this time.
0 commit comments