@@ -56,6 +56,7 @@ fn branch_cli_id(name: &str, id: &str, stack_id: Option<StackId>) -> Arc<CliId>
5656 } )
5757}
5858
59+ #[ expect( dead_code) ]
5960fn stack_cli_id ( id : & str , stack_id : StackId ) -> Arc < CliId > {
6061 Arc :: new ( CliId :: Stack {
6162 id : id. into ( ) ,
@@ -877,7 +878,6 @@ fn movement_does_not_panic_or_move_when_cursor_is_out_of_bounds() {
877878 cursor = new_cursor;
878879 }
879880
880- assert_eq ! ( cursor. closest_branch_cursor( & lines) , None ) ;
881881 assert_eq ! ( cursor, Cursor ( 99 ) ) ;
882882}
883883
@@ -1044,163 +1044,6 @@ fn move_previous_section_does_not_move_when_on_first_jump_target() {
10441044 assert_eq ! ( cursor, Cursor ( 0 ) ) ;
10451045}
10461046
1047- #[ test]
1048- fn closest_branch_cursor_from_commit_selects_nearest_preceding_branch ( ) {
1049- let lines = vec ! [
1050- line( StatusOutputLineData :: Branch {
1051- cli_id: branch_cli_id( "main" , "b0" , None ) ,
1052- } ) ,
1053- line( StatusOutputLineData :: Commit {
1054- cli_id: commit_cli_id( "1111111111111111111111111111111111111111" , "c0" ) ,
1055- stack_id: None ,
1056- classification: CommitClassification :: LocalOnly ,
1057- } ) ,
1058- line( StatusOutputLineData :: Branch {
1059- cli_id: branch_cli_id( "feature" , "b1" , None ) ,
1060- } ) ,
1061- line( StatusOutputLineData :: Commit {
1062- cli_id: commit_cli_id( "2222222222222222222222222222222222222222" , "c1" ) ,
1063- stack_id: None ,
1064- classification: CommitClassification :: LocalOnly ,
1065- } ) ,
1066- ] ;
1067-
1068- let cursor = Cursor ( 3 ) ;
1069-
1070- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 2 ) ) ) ;
1071- }
1072-
1073- #[ test]
1074- fn closest_branch_cursor_from_committed_file_selects_nearest_preceding_branch ( ) {
1075- let lines = vec ! [
1076- line( StatusOutputLineData :: Branch {
1077- cli_id: branch_cli_id( "main" , "b0" , None ) ,
1078- } ) ,
1079- line( StatusOutputLineData :: Commit {
1080- cli_id: commit_cli_id( "1111111111111111111111111111111111111111" , "c0" ) ,
1081- stack_id: None ,
1082- classification: CommitClassification :: LocalOnly ,
1083- } ) ,
1084- line( StatusOutputLineData :: File {
1085- cli_id: committed_file_cli_id(
1086- "1111111111111111111111111111111111111111" ,
1087- "src/lib.rs" ,
1088- "f0" ,
1089- ) ,
1090- } ) ,
1091- ] ;
1092-
1093- let cursor = Cursor ( 2 ) ;
1094-
1095- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 0 ) ) ) ;
1096- }
1097-
1098- #[ test]
1099- fn closest_branch_cursor_from_branch_is_noop ( ) {
1100- let lines = vec ! [ line( StatusOutputLineData :: Branch {
1101- cli_id: branch_cli_id( "main" , "b0" , None ) ,
1102- } ) ] ;
1103-
1104- let cursor = Cursor ( 0 ) ;
1105-
1106- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 0 ) ) ) ;
1107- }
1108-
1109- #[ test]
1110- fn closest_branch_cursor_from_unassigned_changes_selects_first_branch ( ) {
1111- let lines = vec ! [
1112- line( StatusOutputLineData :: UnassignedChanges {
1113- cli_id: unassigned( "u0" ) ,
1114- } ) ,
1115- line( StatusOutputLineData :: Branch {
1116- cli_id: branch_cli_id( "first" , "b0" , None ) ,
1117- } ) ,
1118- line( StatusOutputLineData :: Branch {
1119- cli_id: branch_cli_id( "second" , "b1" , None ) ,
1120- } ) ,
1121- ] ;
1122-
1123- let cursor = Cursor ( 0 ) ;
1124-
1125- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 1 ) ) ) ;
1126- }
1127-
1128- #[ test]
1129- fn closest_branch_cursor_from_unassigned_file_selects_first_branch ( ) {
1130- let lines = vec ! [
1131- line( StatusOutputLineData :: File {
1132- cli_id: unassigned( "u0" ) ,
1133- } ) ,
1134- line( StatusOutputLineData :: Branch {
1135- cli_id: branch_cli_id( "first" , "b0" , None ) ,
1136- } ) ,
1137- ] ;
1138-
1139- let cursor = Cursor ( 0 ) ;
1140-
1141- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 1 ) ) ) ;
1142- }
1143-
1144- #[ test]
1145- fn closest_branch_cursor_from_staged_file_prefers_branch_for_matching_stack ( ) {
1146- let stack_a = StackId :: generate ( ) ;
1147- let stack_b = StackId :: generate ( ) ;
1148- let lines = vec ! [
1149- line( StatusOutputLineData :: Branch {
1150- cli_id: branch_cli_id( "a" , "b0" , Some ( stack_a) ) ,
1151- } ) ,
1152- line( StatusOutputLineData :: Branch {
1153- cli_id: branch_cli_id( "b" , "b1" , Some ( stack_b) ) ,
1154- } ) ,
1155- line( StatusOutputLineData :: StagedFile {
1156- cli_id: stack_cli_id( "s0" , stack_b) ,
1157- } ) ,
1158- ] ;
1159-
1160- let cursor = Cursor ( 2 ) ;
1161-
1162- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 1 ) ) ) ;
1163- }
1164-
1165- #[ test]
1166- fn closest_branch_cursor_from_merge_base_is_noop ( ) {
1167- let lines = vec ! [
1168- line( StatusOutputLineData :: Branch {
1169- cli_id: branch_cli_id( "main" , "b0" , None ) ,
1170- } ) ,
1171- line( StatusOutputLineData :: MergeBase ) ,
1172- ] ;
1173-
1174- let cursor = Cursor ( 1 ) ;
1175-
1176- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 1 ) ) ) ;
1177- }
1178-
1179- #[ test]
1180- fn closest_branch_cursor_falls_back_to_merge_base_when_no_branch_exists ( ) {
1181- let lines = vec ! [
1182- line( StatusOutputLineData :: UnassignedChanges {
1183- cli_id: unassigned( "u0" ) ,
1184- } ) ,
1185- line( StatusOutputLineData :: MergeBase ) ,
1186- ] ;
1187-
1188- let cursor = Cursor ( 0 ) ;
1189-
1190- assert_eq ! ( cursor. closest_branch_cursor( & lines) , Some ( Cursor ( 1 ) ) ) ;
1191- }
1192-
1193- #[ test]
1194- fn closest_branch_cursor_is_none_when_no_branch_exists ( ) {
1195- let lines = vec ! [ line( StatusOutputLineData :: UnassignedChanges {
1196- cli_id: unassigned( "u0" ) ,
1197- } ) ] ;
1198-
1199- let cursor = Cursor ( 0 ) ;
1200-
1201- assert_eq ! ( cursor. closest_branch_cursor( & lines) , None ) ;
1202- }
1203-
12041047#[ test]
12051048fn move_up_in_rub_mode_skips_unavailable_targets ( ) {
12061049 let allowed = Arc :: new ( CliId :: Branch {
0 commit comments