File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -297,20 +297,21 @@ fn apply_to_commit2(
297297
298298 let filtered_tree = match & to_op ( filter) {
299299 Op :: Linear => {
300- let p: Vec < _ > = commit. parents ( ) . collect ( ) ;
300+ let p: Vec < _ > = commit. parent_ids ( ) . collect ( ) ;
301301 if p. len ( ) == 0 {
302+ transaction. insert ( filter, commit. id ( ) , commit. id ( ) , true ) ;
302303 return Ok ( Some ( commit. id ( ) ) ) ;
303304 }
304- let parent = some_or ! ( apply_to_commit2 ( op , & p[ 0 ] , transaction ) ? , {
305+ let parent = some_or ! ( transaction . get ( filter , p[ 0 ] ) , {
305306 return Ok ( None ) ;
306307 } ) ;
307308
308- let parent_commit = repo. find_commit ( parent) ?;
309- return Some ( history:: rewrite_commit (
310- repo,
309+ return Some ( history:: create_filtered_commit (
311310 commit,
312- & [ & parent_commit] ,
313- & commit. tree ( ) ?,
311+ vec ! [ parent] ,
312+ commit. tree ( ) ?,
313+ transaction,
314+ filter,
314315 ) )
315316 . transpose ( ) ;
316317 }
Original file line number Diff line number Diff line change 3232 * add file1
3333
3434 $ josh-filter -s : linear refs/ heads/ master -- update refs/ heads/ filtered
35+ [3 ] : linear
3536
3637 $ git log -- graph -- pretty= % s refs/ heads/ filtered
3738 * Merge branch ' branch2'
5657 * add file1
5758
5859 $ josh-filter -s : linear refs/ heads/ master -- update refs/ heads/ filtered -- reverse
60+ [3 ] : linear
5961
6062 $ git log -- graph -- pretty= % s refs/ heads/ master
6163 * mod file2
You can’t perform that action at this time.
0 commit comments