3 test_description='test @{-N} syntax'
15 test_expect_success 'setup' '
33 # and 'side' should be the last branch
35 git log --graph --all --pretty=oneline --decorate
37 test_rev_equivalent () {
39 git rev-parse "$1" > expect &&
40 git rev-parse "$2" > output &&
41 test_cmp expect output
45 test_expect_success '@{-1} works' '
46 test_rev_equivalent side @{-1}
49 test_expect_success '@{-1}~2 works' '
50 test_rev_equivalent side~2 @{-1}~2
53 test_expect_success '@{-1}^2 works' '
54 test_rev_equivalent side^2 @{-1}^2
57 test_expect_failure '@{-1}@{1} works' '
58 test_rev_equivalent side@{1} @{-1}@{1}
61 test_expect_success '@{-2} works' '
62 test_rev_equivalent master @{-2}
65 test_expect_success '@{-3} fails' '
66 test_must_fail git rev-parse @{-3}