Cleaning up scripts to only include useful stuff.
[git-central.git] / tests / t2101-server-update-stable-and-prefer-rebased.sh
1 #!/bin/sh
2
3 test_description='server update stable enforcer still works with prefer rebased'
4
5 . ./test-lib.sh
6
7 test_expect_success 'setup' '
8         echo setup >a &&
9         git add a &&
10         git commit -m "a" &&
11         git clone ./. server &&
12         git remote add origin ./server &&
13         rm -fr server/.git/hooks
14 '
15
16 # setup the update hook
17 install_update_hook 'update-stable' 'update-prefer-rebase'
18
19 test_expect_success 'initial stable commit works' '
20         # do one stable-less commit
21         echo $test_name >a &&
22         git commit -a -m "$test_name" &&
23         git push origin master &&
24
25         git checkout -b stable &&
26         git push origin stable &&
27         git config --add branch.stable.remote origin &&
28         git config --add branch.stable.merge refs/heads/stable
29 '
30
31 test_expect_success 'accept merge' '
32         # make one topic branch
33         git checkout -b topic1 stable &&
34         echo $test_name >topic1 &&
35         git add topic1 &&
36         git commit -m "$test_name topic1" &&
37         git push origin topic1 &&
38
39         # try merging topic1 into stable, which will get a merge commit, but
40         # it should have changes involved and so get rejected
41         git checkout stable &&
42         git merge --no-ff topic1 &&
43         git push
44 '
45
46 test_done
47