File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,16 @@ func (t *commitFilesTable) PartitionRows(
102102 return nil , err
103103 }
104104
105+ var index sql.IndexValueIter
106+ if t .index != nil {
107+ if index , err = t .index .Values (p ); err != nil {
108+ return nil , err
109+ }
110+ }
111+
105112 return & commitFilesRowIter {
106113 repo : repo ,
114+ index : index ,
107115 commitHashes : stringsToHashes (hashes ),
108116 paths : paths ,
109117 skipGitErrors : shouldSkipErrors (ctx ),
Original file line number Diff line number Diff line change @@ -106,3 +106,36 @@ func TestCommitFilesIndexIterClosed(t *testing.T) {
106106func TestCommitFilesIterClosed (t * testing.T ) {
107107 testTableIterClosed (t , new (commitFilesTable ))
108108}
109+
110+ func TestPartitionRowsWithIndex (t * testing.T ) {
111+
112+ t .Helper ()
113+ require := require .New (t )
114+ ctx , _ , cleanup := setup (t )
115+ defer cleanup ()
116+
117+ table := new (commitFilesTable )
118+ expected , err := tableToRows (ctx , table )
119+ require .NoError (err )
120+
121+ lookup := tableIndexLookup (t , table , ctx )
122+ tbl := table .WithIndexLookup (lookup )
123+
124+ pit , err := tbl .Partitions (ctx )
125+ require .NoError (err )
126+
127+ i := 0
128+ for p , e := pit .Next (); e != io .EOF ; p , e = pit .Next () {
129+ require .NoError (e )
130+
131+ rit , err := tbl .PartitionRows (ctx , p )
132+ require .NoError (err )
133+
134+ for r , e := rit .Next (); e != io .EOF ; r , e = rit .Next () {
135+ require .NoError (e )
136+
137+ require .ElementsMatch (expected [i ], r )
138+ i ++
139+ }
140+ }
141+ }
You can’t perform that action at this time.
0 commit comments