3 test_description
='test @{-N} syntax'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
18 test_expect_success
'setup' '
36 # and 'side' should be the last branch
38 test_expect_success
'@{-1} works' '
39 test_cmp_rev side @{-1}
42 test_expect_success
'@{-1}~2 works' '
43 test_cmp_rev side~2 @{-1}~2
46 test_expect_success
'@{-1}^2 works' '
47 test_cmp_rev side^2 @{-1}^2
50 test_expect_success
'@{-1}@{1} works' '
51 test_cmp_rev side@{1} @{-1}@{1}
54 test_expect_success
'@{-2} works' '
55 test_cmp_rev main @{-2}
58 test_expect_success
'@{-3} fails' '
59 test_must_fail git rev-parse @{-3}