3 test_description='script checkout'
7 export PATH=$PATH:../../scripts
9 test_expect_success 'setup' '
12 git commit -m "setup" &&
13 git clone ./. server &&
14 rm -fr server/.git/hooks &&
15 git remote add origin ./server
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' '
29 git checkout -b topic2 stable &&
30 echo "$test_name on server" >a &&
31 git commit -a -m "Made topic2 on server" &&
34 ! git branch | grep topic2 &&
36 git branch | grep topic2 &&
37 git branch -r | grep origin/topic2 &&
38 git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
40 echo "$test_name on client" >a &&
41 git commit -a -m "Move topic2 on client" &&
42 git push origin topic2
45 test_expect_success 'checkout an existing local branch' '
49 test_expect_success 'checkout a revision does not create a new branch' '
50 echo "$test_name" >a &&
51 git commit -a -m "$test_name" &&
53 prior=$(git rev-parse HEAD^) &&
55 git branch | grep "no branch"