@@ -909,6 +909,67 @@ fn test_navigation_switch_revset() -> eyre::Result<()> {
909
909
"### ) ;
910
910
}
911
911
912
+ {
913
+ // switching back to "last checkout"
914
+ let ( stdout, _stderr) = git. branchless ( "switch" , & [ "@{-1}" ] ) ?;
915
+ insta:: assert_snapshot!( stdout, @r###"
916
+ branchless: running command: <git-executable> checkout @{-1}
917
+ O f777ecc (master) create initial.txt
918
+ |\
919
+ | o 62fc20d create test1.txt
920
+ |
921
+ @ fe65c1f create test2.txt
922
+ "### ) ;
923
+ }
924
+
925
+ {
926
+ // switching back to "last checkout"
927
+ let ( stdout, _stderr) = git. branchless ( "switch" , & [ "-" ] ) ?;
928
+ insta:: assert_snapshot!( stdout, @r###"
929
+ branchless: running command: <git-executable> checkout -
930
+ @ f777ecc (master) create initial.txt
931
+ |\
932
+ | o 62fc20d create test1.txt
933
+ |
934
+ o fe65c1f create test2.txt
935
+ "### ) ;
936
+ }
937
+
938
+ {
939
+ // switching back to "last checkout" will also checkout last checked out
940
+ // branch, if any
941
+
942
+ let ( stdout, _stderr) = git. branchless ( "switch" , & [ "master" ] ) ?;
943
+ insta:: assert_snapshot!( stdout, @r###"
944
+ branchless: running command: <git-executable> checkout master
945
+ @ f777ecc (> master) create initial.txt
946
+ |\
947
+ | o 62fc20d create test1.txt
948
+ |
949
+ o fe65c1f create test2.txt
950
+ "### ) ;
951
+
952
+ let ( stdout, _stderr) = git. branchless ( "switch" , & [ "@{-2}" ] ) ?;
953
+ insta:: assert_snapshot!( stdout, @r###"
954
+ branchless: running command: <git-executable> checkout @{-2}
955
+ O f777ecc (master) create initial.txt
956
+ |\
957
+ | o 62fc20d create test1.txt
958
+ |
959
+ @ fe65c1f create test2.txt
960
+ "### ) ;
961
+
962
+ let ( stdout, _stderr) = git. branchless ( "switch" , & [ "-" ] ) ?;
963
+ insta:: assert_snapshot!( stdout, @r###"
964
+ branchless: running command: <git-executable> checkout -
965
+ @ f777ecc (> master) create initial.txt
966
+ |\
967
+ | o 62fc20d create test1.txt
968
+ |
969
+ o fe65c1f create test2.txt
970
+ "### ) ;
971
+ }
972
+
912
973
Ok ( ( ) )
913
974
}
914
975
0 commit comments