@@ -34,11 +34,11 @@ type Branch struct {
34
34
}
35
35
36
36
// GetHEADBranch returns corresponding branch of HEAD.
37
- func (repo * Repository ) GetHEADBranch () (* Branch , error ) {
37
+ func (repo * Repository ) GetHEADBranch (ctx context. Context ) (* Branch , error ) {
38
38
if repo == nil {
39
39
return nil , fmt .Errorf ("nil repo" )
40
40
}
41
- stdout , _ , err := NewCommand ("symbolic-ref" , "HEAD" ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
41
+ stdout , _ , err := NewCommand ("symbolic-ref" , "HEAD" ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
42
42
if err != nil {
43
43
return nil , err
44
44
}
@@ -104,7 +104,7 @@ type DeleteBranchOptions struct {
104
104
}
105
105
106
106
// DeleteBranch delete a branch by name on repository.
107
- func (repo * Repository ) DeleteBranch (name string , opts DeleteBranchOptions ) error {
107
+ func (repo * Repository ) DeleteBranch (ctx context. Context , name string , opts DeleteBranchOptions ) error {
108
108
cmd := NewCommand ("branch" )
109
109
110
110
if opts .Force {
@@ -114,17 +114,17 @@ func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) erro
114
114
}
115
115
116
116
cmd .AddDashesAndList (name )
117
- _ , _ , err := cmd .RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
117
+ _ , _ , err := cmd .RunStdString (ctx , & RunOpts {Dir : repo .Path })
118
118
119
119
return err
120
120
}
121
121
122
122
// CreateBranch create a new branch
123
- func (repo * Repository ) CreateBranch (branch , oldbranchOrCommit string ) error {
123
+ func (repo * Repository ) CreateBranch (ctx context. Context , branch , oldbranchOrCommit string ) error {
124
124
cmd := NewCommand ("branch" )
125
125
cmd .AddDashesAndList (branch , oldbranchOrCommit )
126
126
127
- _ , _ , err := cmd .RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
127
+ _ , _ , err := cmd .RunStdString (ctx , & RunOpts {Dir : repo .Path })
128
128
129
129
return err
130
130
}
0 commit comments