3 test_description
='test @{-N} syntax'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK
=true
19 test_expect_success
'setup' '
37 # and 'side' should be the last branch
39 test_expect_success
'@{-1} works' '
40 test_cmp_rev side @{-1}
43 test_expect_success
'@{-1}~2 works' '
44 test_cmp_rev side~2 @{-1}~2
47 test_expect_success
'@{-1}^2 works' '
48 test_cmp_rev side^2 @{-1}^2
51 test_expect_success
'@{-1}@{1} works' '
52 test_cmp_rev side@{1} @{-1}@{1}
55 test_expect_success
'@{-2} works' '
56 test_cmp_rev main @{-2}
59 test_expect_success
'@{-3} fails' '
60 test_must_fail git rev-parse @{-3}