@@ -290,17 +290,17 @@ func (repo *Repository) FilesCountBetween(ctx context.Context, startCommitID, en
290290
291291// CommitsBetween returns a list that contains commits between [before, last).
292292// If before is detached (removed by reset + push) it is not included.
293- func (repo * Repository ) CommitsBetween (last , before * Commit ) ([]* Commit , error ) {
293+ func (repo * Repository ) CommitsBetween (ctx context. Context , last , before * Commit ) ([]* Commit , error ) {
294294 var stdout []byte
295295 var err error
296296 if before == nil {
297- stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (last .ID .String ()).RunStdBytes (repo . Ctx , & RunOpts {Dir : repo .Path })
297+ stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (last .ID .String ()).RunStdBytes (ctx , & RunOpts {Dir : repo .Path })
298298 } else {
299- stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (before .ID .String ()+ ".." + last .ID .String ()).RunStdBytes (repo . Ctx , & RunOpts {Dir : repo .Path })
299+ stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (before .ID .String ()+ ".." + last .ID .String ()).RunStdBytes (ctx , & RunOpts {Dir : repo .Path })
300300 if err != nil && strings .Contains (err .Error (), "no merge base" ) {
301301 // future versions of git >= 2.28 are likely to return an error if before and last have become unrelated.
302302 // previously it would return the results of git rev-list before last so let's try that...
303- stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (before .ID .String (), last .ID .String ()).RunStdBytes (repo . Ctx , & RunOpts {Dir : repo .Path })
303+ stdout , _ , err = NewCommand ("rev-list" ).AddDynamicArguments (before .ID .String (), last .ID .String ()).RunStdBytes (ctx , & RunOpts {Dir : repo .Path })
304304 }
305305 }
306306 if err != nil {
@@ -359,20 +359,20 @@ func (repo *Repository) CommitsBetweenNotBase(ctx context.Context, last, before
359359 return repo .parsePrettyFormatLogToList (bytes .TrimSpace (stdout ))
360360}
361361
362- // CommitsBetweenIDs return commits between twoe commits
363- func (repo * Repository ) CommitsBetweenIDs (last , before string ) ([]* Commit , error ) {
362+ // CommitsBetweenIDs return commits between two commits
363+ func (repo * Repository ) CommitsBetweenIDs (ctx context. Context , last , before string ) ([]* Commit , error ) {
364364 lastCommit , err := repo .GetCommit (last )
365365 if err != nil {
366366 return nil , err
367367 }
368368 if before == "" {
369- return repo .CommitsBetween (lastCommit , nil )
369+ return repo .CommitsBetween (ctx , lastCommit , nil )
370370 }
371371 beforeCommit , err := repo .GetCommit (before )
372372 if err != nil {
373373 return nil , err
374374 }
375- return repo .CommitsBetween (lastCommit , beforeCommit )
375+ return repo .CommitsBetween (ctx , lastCommit , beforeCommit )
376376}
377377
378378// CommitsCountBetween return numbers of commits between two commits
@@ -495,8 +495,8 @@ func (repo *Repository) GetCommitsFromIDs(commitIDs []string) []*Commit {
495495}
496496
497497// IsCommitInBranch check if the commit is on the branch
498- func (repo * Repository ) IsCommitInBranch (commitID , branch string ) (r bool , err error ) {
499- stdout , _ , err := NewCommand ("branch" , "--contains" ).AddDynamicArguments (commitID , branch ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
498+ func (repo * Repository ) IsCommitInBranch (ctx context. Context , commitID , branch string ) (r bool , err error ) {
499+ stdout , _ , err := NewCommand ("branch" , "--contains" ).AddDynamicArguments (commitID , branch ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
500500 if err != nil {
501501 return false , err
502502 }
0 commit comments