3 test_description
='test @{-N} syntax'
15 test_expect_success
'setup' '
33 # and 'side' should be the last branch
35 test_rev_equivalent
() {
37 git rev-parse
"$1" > expect
&&
38 git rev-parse
"$2" > output
&&
39 test_cmp expect output
43 test_expect_success
'@{-1} works' '
44 test_rev_equivalent side @{-1}
47 test_expect_success
'@{-1}~2 works' '
48 test_rev_equivalent side~2 @{-1}~2
51 test_expect_success
'@{-1}^2 works' '
52 test_rev_equivalent side^2 @{-1}^2
55 test_expect_success
'@{-1}@{1} works' '
56 test_rev_equivalent side@{1} @{-1}@{1}
59 test_expect_success
'@{-2} works' '
60 test_rev_equivalent master @{-2}
63 test_expect_success
'@{-3} fails' '
64 test_must_fail git rev-parse @{-3}