File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -274,20 +274,24 @@ git commit -m {commit_id}
274
274
// In almost all cases, `children` will only have one element. The exception are merge
275
275
// commits where there’s changes against each parent. Each of these changes would
276
276
// produce a diff that’s represented in `self.blame_path`.
277
- let children = self
277
+ let mut children: Vec < _ > = self
278
278
. blame_path
279
279
. iter ( )
280
280
. enumerate ( )
281
- . filter ( |( _, x) | x. commit_id == child. commit_id ) ;
281
+ . filter ( |( _, x) | x. commit_id == child. commit_id )
282
+ . collect ( ) ;
283
+
284
+ children. sort_by_key ( |( _, x) | x. index ) ;
282
285
283
286
let parents = children
287
+ . iter ( )
284
288
. filter_map ( |( index, child) | {
285
289
let parent_blob_id = child. previous_blob_id ;
286
290
let parent_source_file_path = & child. previous_source_file_path ;
287
291
288
292
// When we search for a parent we only have to consider entries up to and
289
293
// excluding `index` as anything after `index` can only be a child.
290
- self . blame_path [ ..index]
294
+ self . blame_path [ ..( * index) ]
291
295
. iter ( )
292
296
. rfind ( |& x| {
293
297
x. blob_id == parent_blob_id && Some ( & x. source_file_path ) == parent_source_file_path. as_ref ( )
You can’t perform that action at this time.
0 commit comments