@@ -146,6 +146,7 @@ func (es Entries) Sort() {
146146// EntryCommitInfo contains a tree entry with its commit information.
147147type EntryCommitInfo struct {
148148 Entry * TreeEntry
149+ Index int
149150 Commit * Commit
150151 Submodule * Submodule
151152}
@@ -212,7 +213,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
212213 // Block until there is an empty slot to control the maximum concurrency
213214 bucket <- struct {}{}
214215
215- go func (e * TreeEntry ) {
216+ go func (e * TreeEntry , i int ) {
216217 defer func () {
217218 wg .Done ()
218219 <- bucket
@@ -225,6 +226,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
225226
226227 info := & EntryCommitInfo {
227228 Entry : e ,
229+ Index : i ,
228230 }
229231 epath := path .Join (opt .Path , e .Name ())
230232
@@ -248,7 +250,7 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
248250 }
249251
250252 results <- info
251- }(e )
253+ }(e , i )
252254 }
253255 }()
254256
@@ -258,14 +260,10 @@ func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*En
258260 }
259261
260262 close (results )
261- infos := make (map [[20 ]byte ]* EntryCommitInfo , len (es ))
262- for info := range results {
263- infos [info .Entry .id .bytes ] = info
264- }
265263
266264 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
269267 }
270268 return commitsInfo , nil
271269}
0 commit comments