Remove the server-/client- prefixes in the tests.
[git-central.git] / tests / t2204-post-receive-email-conflicts.sh
1 #!/bin/sh
2
3 test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
4
5 . ./test-lib.sh
6
7 export USER_EMAIL=author@example.com
8
9 test_expect_success 'setup' '
10         echo "setup" >a &&
11         echo "setup" >b &&
12         echo "setup" >c &&
13         git add a b c &&
14         git commit -m "setup" &&
15         git clone ./. server &&
16         rm -fr server/.git/hooks &&
17         git remote add origin ./server &&
18         git config branch.master.remote origin &&
19         git config branch.master.merge refs/heads/master &&
20         GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
21         GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
22         echo cbas >./server/.git/description &&
23
24         git checkout -b stable &&
25         git push origin stable
26 '
27
28 install_post_receive_hook 'post-receive-email'
29
30 test_expect_success 'conflict diff' '
31         git checkout stable &&
32         echo "line1" >a &&
33         echo "line2" >>a &&
34         echo "line3" >>a &&
35         git commit -a -m "lines" &&
36         git push origin stable &&
37
38         git checkout -b topic1 stable &&
39         echo "line1.topic1" >a &&
40         echo "line2.topic1" >>a &&
41         echo "line3.topic1" >>a &&
42         git commit -a -m "lines changed on topic1" &&
43         git push origin topic1 &&
44
45         old_commit_hash=$(git rev-parse HEAD) &&
46         old_commit_abbrev=$(git rev-parse --short HEAD) &&
47
48         # Move stable
49         git checkout stable &&
50         echo "line1.stable" >a &&
51         echo "line2.stable" >>a &&
52         echo "line3.stable" >>a &&
53         git commit -a -m "lines changed on stable" &&
54         git push origin stable &&
55
56         stable_hash=$(git rev-parse HEAD) &&
57
58         git checkout topic1 &&
59         ! git merge stable &&
60
61         echo "line1.topic" >a &&
62         echo "line2.stable" >>a &&
63         echo "line3.resolved" >>a &&
64         git add a &&
65         git commit -a -m "resolved lines for merging stable into topic1" &&
66         second_stable_hash=$(git rev-parse HEAD) &&
67         git push origin topic1 &&
68
69         new_commit_hash=$(git rev-parse HEAD) &&
70         new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
71         new_commit_abbrev=$(git rev-parse --short HEAD) &&
72
73         interpolate ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_hash &&
74         test_cmp 1.txt server/.git/refs.heads.topic1.out
75 '
76
77 test_done
78