config --get --path: check for unset $HOME
[git/mingw/4msysgit/kblees.git] / t / t0100-previous.sh
blob315b9b3f10cfae0186afca6f8024d73cce0a19e2
1 #!/bin/sh
3 test_description='previous branch syntax @{-n}'
5 . ./test-lib.sh
7 test_expect_success 'branch -d @{-1}' '
8 test_commit A &&
9 git checkout -b junk &&
10 git checkout - &&
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 &&
19 git checkout - &&
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}' '
26 git checkout A &&
27 test_commit B &&
28 git checkout A &&
29 test_commit C &&
30 git branch -f master B &&
31 git branch -f other &&
32 git checkout other &&
33 git checkout master &&
34 git merge @{-1} &&
35 git cat-file commit HEAD | grep "Merge branch '\''other'\''"
38 test_expect_success 'merge @{-1} when there is not enough switches yet' '
39 git reflog expire --expire=now &&
40 git checkout -f master &&
41 git reset --hard B &&
42 git branch -f other C &&
43 git checkout other &&
44 git checkout master &&
45 test_must_fail git merge @{-12}
48 test_done