@@ -5187,3 +5187,134 @@ fn test_move_fixup_tree() -> eyre::Result<()> {
51875187
51885188 Ok ( ( ) )
51895189}
5190+
5191+ #[ test]
5192+ fn test_move_fixup_multiple_disconnected_into_parent ( ) -> eyre:: Result < ( ) > {
5193+ let git = make_git ( ) ?;
5194+
5195+ if !git. supports_committer_date_is_author_date ( ) ? {
5196+ return Ok ( ( ) ) ;
5197+ }
5198+ git. init_repo ( ) ?;
5199+
5200+ git. detach_head ( ) ?;
5201+ let test1_oid = git. commit_file ( "test1" , 1 ) ?;
5202+ let _test2_oid = git. commit_file ( "test2" , 2 ) ?;
5203+ let test3_oid = git. commit_file ( "test3" , 3 ) ?;
5204+ let _test4_oid = git. commit_file ( "test4" , 4 ) ?;
5205+ let test5_oid = git. commit_file ( "test5" , 5 ) ?;
5206+ let _test6_oid = git. commit_file ( "test6" , 6 ) ?;
5207+
5208+ let ( stdout, _stderr) = git. run ( & [ "smartlog" ] ) ?;
5209+ insta:: assert_snapshot!( stdout, @r###"
5210+ O f777ecc (master) create initial.txt
5211+ |
5212+ o 62fc20d create test1.txt
5213+ |
5214+ o 96d1c37 create test2.txt
5215+ |
5216+ o 70deb1e create test3.txt
5217+ |
5218+ o 355e173 create test4.txt
5219+ |
5220+ o f81d55c create test5.txt
5221+ |
5222+ @ 2831fb5 create test6.txt
5223+ "### ) ;
5224+
5225+ let ( stdout, _stderr) = git. run ( & [
5226+ "show" ,
5227+ "--pretty=format:" ,
5228+ "--name-only" ,
5229+ & test1_oid. to_string ( ) ,
5230+ ] ) ?;
5231+ insta:: assert_snapshot!( stdout, @r###"
5232+ test1.txt
5233+ "### ) ;
5234+
5235+ // --on-disk
5236+ // FIXME on disk is not working :(
5237+ // {
5238+ // let git = git.duplicate_repo()?;
5239+ // git.run(&[
5240+ // "move",
5241+ // "--on-disk",
5242+ // "--fixup",
5243+ // "--debug-dump-rebase-plan",
5244+ // "-x",
5245+ // &test2_oid.to_string(),
5246+ // "-d",
5247+ // &test1_oid.to_string(),
5248+ // ])?;
5249+
5250+ // let (stdout, _stderr) = git.run(&["smartlog"])?;
5251+ // insta::assert_snapshot!(stdout, @r###"
5252+ // O f777ecc (master) create initial.txt
5253+ // |
5254+ // o 62fc20d create test1.txt
5255+ // |
5256+ // @ 68aa706 create test3.txt
5257+ // "###);
5258+ // }
5259+
5260+ // --in-memory
5261+ {
5262+ let ( _stdout, _stderr) = git. run ( & [
5263+ "move" ,
5264+ "--in-memory" ,
5265+ "--debug-dump-rebase-plan" ,
5266+ "--fixup" ,
5267+ // "--debug-dump-rebase-plan",
5268+ "-x" ,
5269+ & format ! ( "{}+{}" , test3_oid, test5_oid) ,
5270+ "-d" ,
5271+ & test1_oid. to_string ( ) ,
5272+ ] ) ?;
5273+ // insta::assert_snapshot!(_stderr, @r###""###);
5274+ insta:: assert_snapshot!( _stdout, @r###"
5275+ Attempting rebase in-memory...
5276+ [1/3] Committed as: bf0d52a create test4.txt
5277+ [2/3] Amended as: 9ede80c create test1.txt
5278+ [3/3] Amended as: 9ede80c create test1.txt
5279+ branchless: processing 4 rewritten commits
5280+ branchless: running command: <git-executable> checkout dbc9c345de124eecad564e5de1259d7ca4eaf99b
5281+ O f777ecc (master) create initial.txt
5282+ |
5283+ o 9ede80c create test1.txt
5284+ |
5285+ o 9ede80c create test2.txt
5286+ |
5287+ o 0b465e8 create test4.txt
5288+ |
5289+ @ 0b465e8 create test6.txt
5290+ In-memory rebase succeeded.
5291+ "### ) ;
5292+
5293+ // FIXME can we do this w/o needing to restack?
5294+ let ( stdout, _stderr) = git. run ( & [ "restack" ] ) ?;
5295+ // insta::assert_snapshot!(stderr, @r###""###);
5296+ insta:: assert_snapshot!( stdout, @r###"
5297+ Attempting rebase in-memory...
5298+ [1/2] Committed as: 0b465e8 create test3.txt
5299+ [2/2] Committed as: 0b465e8 create test5.txt
5300+ branchless: processing 2 rewritten commits
5301+ branchless: running command: <git-executable> checkout 0b465e8fb1992620af8d4c0a44ea2c881ea2324d
5302+ In-memory rebase succeeded.
5303+ Finished restacking commits.
5304+ No abandoned branches to restack.
5305+ O f777ecc (master) create initial.txt
5306+ |
5307+ o 9ede80c create test1.txt
5308+ |
5309+ o 9ede80c create test2.txt
5310+ |
5311+ o 0b465e8 create test4.txt
5312+ |
5313+ @ 0b465e8 create test6.txt
5314+ "### ) ;
5315+
5316+ // TODO verify contents
5317+ }
5318+
5319+ Ok ( ( ) )
5320+ }
0 commit comments