@@ -146,6 +146,7 @@ func (es Entries) Sort() {
146
146
// EntryCommitInfo contains a tree entry with its commit information.
147
147
type EntryCommitInfo struct {
148
148
Entry * TreeEntry
149
+ Index int
149
150
Commit * Commit
150
151
Submodule * Submodule
151
152
}
@@ -212,7 +213,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
212
213
// Block until there is an empty slot to control the maximum concurrency
213
214
bucket <- struct {}{}
214
215
215
- go func (e * TreeEntry ) {
216
+ go func (e * TreeEntry , i int ) {
216
217
defer func () {
217
218
wg .Done ()
218
219
<- bucket
@@ -225,6 +226,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
225
226
226
227
info := & EntryCommitInfo {
227
228
Entry : e ,
229
+ Index : i ,
228
230
}
229
231
epath := path .Join (opt .Path , e .Name ())
230
232
@@ -248,7 +250,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
248
250
}
249
251
250
252
results <- info
251
- }(e )
253
+ }(e , i )
252
254
}
253
255
}()
254
256
@@ -258,14 +260,10 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
258
260
}
259
261
260
262
close (results )
261
- infos := make (map [[20 ]byte ]* EntryCommitInfo , len (es ))
262
- for info := range results {
263
- infos [info .Entry .id .bytes ] = info
264
- }
265
263
266
264
commitsInfo := make ([]* EntryCommitInfo , len (es ))
267
- for i , e := range es {
268
- commitsInfo [i ] = infos [ e . id . bytes ]
265
+ for info := range results {
266
+ commitsInfo [info . Index ] = info
269
267
}
270
268
return commitsInfo , nil
271
269
}
0 commit comments