3 test_description
='previous branch syntax @{-n}'
7 test_expect_success
'branch -d @{-1}' '
9 git checkout -b junk &&
11 test "$(git symbolic-ref HEAD)" = refs/heads/master &&
12 git branch -d @{-1} &&
13 test_must_fail git rev-parse --verify refs/heads/junk
16 test_expect_success
'branch -d @{-12} when there is not enough switches yet' '
17 git reflog expire --expire=now &&
18 git checkout -b junk2 &&
20 test "$(git symbolic-ref HEAD)" = refs/heads/master &&
21 test_must_fail git branch -d @{-12} &&
22 git rev-parse --verify refs/heads/master
25 test_expect_success
'merge @{-1}' '
31 git branch -f master B &&
32 git branch -f other &&
34 git checkout master &&
36 git cat-file commit HEAD | grep "Merge branch '\''other'\''"
39 test_expect_success
'merge @{-1}~1' '
40 git checkout master &&
43 git checkout master &&
45 git cat-file commit HEAD >actual &&
46 grep "Merge branch '\''other'\''" actual
49 test_expect_success
'merge @{-100} before checking out that many branches yet' '
50 git reflog expire --expire=now &&
51 git checkout -f master &&
53 git branch -f other C &&
55 git checkout master &&
56 test_must_fail git merge @{-100}
59 test_expect_success
'log -g @{-1}' '
60 git checkout -b last_branch &&
61 git checkout -b new_branch &&
62 echo "last_branch@{0}" >expect &&
63 git log -g --format=%gd @{-1} >actual &&
64 test_cmp expect actual