Get tests passing again.
[git-central.git] / tests / t5000-checkout.sh
1 #!/bin/bash
2
3 test_description='script checkout'
4
5 . ./test-lib.sh
6
7 export PATH=$PATH:../../scripts
8
9 test_expect_success 'setup' '
10         echo "setup" >a &&
11         git add a &&
12         git commit -m "setup" &&
13         git clone -l . --bare server.git &&
14         rm -fr server.git/hooks &&
15         git remote add origin ./server.git
16         git checkout -b stable &&
17         git push origin stable
18 '
19
20 test_expect_success 'checkout a new branch clones stable' '
21         checkout topic1 &&
22         git branch | grep topic1 &&
23         git branch -r | grep origin/topic1 &&
24         git config --list | grep "branch.topic1.merge=refs/heads/topic1"
25 '
26
27 test_expect_success 'checkout an existing remote branch' '
28         git clone server.git person2 &&
29         cd person2 &&
30         git checkout -b topic2 origin/stable &&
31         echo "$test_name on server" >a &&
32         git commit -a -m "Made topic2 on server" &&
33         git push origin topic2
34         cd .. &&
35
36         ! git branch | grep topic2 &&
37         checkout topic2 &&
38         git branch | grep topic2 &&
39         git branch -r | grep origin/topic2 &&
40         git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
41
42         echo "$test_name on client" >a &&
43         git commit -a -m "Move topic2 on client" &&
44         git push origin topic2
45 '
46
47 test_expect_success 'checkout an existing local branch' '
48         checkout topic1
49 '
50
51 test_expect_success 'checkout a revision does not create a new branch' '
52         echo "$test_name" >a &&
53         git commit -a -m "$test_name" &&
54
55         prior=$(git rev-parse HEAD^) &&
56         checkout $prior &&
57         git branch | grep "no branch"
58 '
59
60 test_done
61