3 test_description='script checkout'
7 export PATH=$PATH:../../scripts
9 test_expect_success 'setup' '
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
20 test_expect_success 'checkout a new branch clones stable' '
22 git branch | grep topic1 &&
23 git branch -r | grep origin/topic1 &&
24 git config --list | grep "branch.topic1.merge=refs/heads/topic1"
27 test_expect_success 'checkout an existing remote branch' '
28 git clone server.git 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
36 ! git branch | grep topic2 &&
38 git branch | grep topic2 &&
39 git branch -r | grep origin/topic2 &&
40 git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
42 echo "$test_name on client" >a &&
43 git commit -a -m "Move topic2 on client" &&
44 git push origin topic2
47 test_expect_success 'checkout an existing local branch' '
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" &&
55 prior=$(git rev-parse HEAD^) &&
57 git branch | grep "no branch"