f47364c75c29cd96b01367ab66c3a8d2fd786481
[git-central.git] / tests / t1100-post-commit-rebase.sh
1 #!/bin/sh
2
3 test_description='client checkout auto-set branch rebase=true'
4
5 . ./test-lib.sh
6
7 test_expect_success 'setup' '
8         echo "setup" >file &&
9         git add file &&
10         git commit -m "setup" &&
11         git clone . ./server &&
12         git remote add origin ./server &&
13         git config branch.master.remote origin &&
14         git config branch.master.merge refs/heads/master
15 '
16
17 # setup the post-checkout hook
18 install_post_checkout_hook 'post-checkout-rebase'
19
20 test_expect_success 'sets rebase on new topic branch' '
21         ! git config --list | grep branch.master.rebase &&
22         git checkout -b topic master &&
23         git config --list | grep branch.topic.rebase=true
24 '
25
26 test_expect_success 'checking out remote branch does nothing' '
27         git push origin topic:topic2 &&
28         git fetch &&
29         git checkout origin/topic2 &&
30         ! git config --list | grep "branch..rebase"
31 '
32
33 test_expect_success 'cloning stable sets up the correct merge' '
34         git push origin topic:stable &&
35         git fetch &&
36         git checkout -b topic3 origin/stable &&
37         test "refs/heads/topic3" = "$(git config branch.topic3.merge)"
38 '
39
40 test_done
41