@@ -89,7 +89,8 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
8989 return commits [0 ], nil
9090}
9191
92- func (repo * Repository ) commitsByRange (id ObjectID , page , pageSize int , not string ) ([]* Commit , error ) {
92+ // commitsByRangeWithTime returns the specific page commits before current revision, with not, since, until support
93+ func (repo * Repository ) commitsByRangeWithTime (id ObjectID , page , pageSize int , not , since , until string ) ([]* Commit , error ) {
9394 cmd := NewCommand ("log" ).
9495 AddOptionFormat ("--skip=%d" , (page - 1 )* pageSize ).
9596 AddOptionFormat ("--max-count=%d" , pageSize ).
@@ -99,6 +100,12 @@ func (repo *Repository) commitsByRange(id ObjectID, page, pageSize int, not stri
99100 if not != "" {
100101 cmd .AddOptionValues ("--not" , not )
101102 }
103+ if since != "" {
104+ cmd .AddOptionFormat ("--since=%s" , since )
105+ }
106+ if until != "" {
107+ cmd .AddOptionFormat ("--until=%s" , until )
108+ }
102109
103110 stdout , _ , err := cmd .RunStdBytes (repo .Ctx , & RunOpts {Dir : repo .Path })
104111 if err != nil {
@@ -212,6 +219,8 @@ type CommitsByFileAndRangeOptions struct {
212219 File string
213220 Not string
214221 Page int
222+ Since string
223+ Until string
215224}
216225
217226// CommitsByFileAndRange return the commits according revision file and the page
@@ -231,6 +240,12 @@ func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions)
231240 if opts .Not != "" {
232241 gitCmd .AddOptionValues ("--not" , opts .Not )
233242 }
243+ if opts .Since != "" {
244+ gitCmd .AddOptionFormat ("--since=%s" , opts .Since )
245+ }
246+ if opts .Until != "" {
247+ gitCmd .AddOptionFormat ("--until=%s" , opts .Until )
248+ }
234249
235250 gitCmd .AddDashesAndList (opts .File )
236251 err := gitCmd .Run (repo .Ctx , & RunOpts {
0 commit comments