3 # Copyright (c) 2005 Petr Baudis
5 test_description
="Tests basic cg-update functionality
7 This isn't very sophisticated, since if cg-fetch and cg-merge
8 works all right, this should do so too - so just check if it
9 does tree merge right, fast-forward right, and the only interesting
10 and update-specific thing, rebased-fastforward."
15 echo file >branch
1/file1
16 test_expect_success
'initialize branch1' \
17 "(cd branch1 && cg-init -I && cg-add file1 && cg-commit -C -m\"Initial commit\")"
18 test_expect_success
'fork branch2' \
19 "cg-clone branch1 branch2"
20 test_expect_success
'registering branch2 in branch1' \
21 "(cd branch1 && cg-branch-add origin ../branch2)"
23 echo "file new in branch1" >branch
1/file-b1
24 test_expect_success
'local commit in branch1' \
25 "(cd branch1 && cg-add file-b1 && cg-commit -m\"Local commit in b1\")"
26 echo "file new in branch2" >branch
2/file-b2
27 test_expect_success
'local commit in branch2' \
28 "(cd branch2 && cg-add file-b2 && cg-commit -m\"Local commit in b2\")"
30 test_expect_success
'updating from branch2 in branch1' \
31 "(cd branch1 && cg-update </dev/null)"
32 test_expect_success
'checking for correct merged content' \
33 "(cmp branch2/file-b2 branch1/file-b2)"
34 test_expect_success
'checking if it was a tree-merge' \
35 "(! cmp branch1/.git/refs/heads/origin branch1/.git/refs/heads/master)"
37 test_expect_success
'fast-forwarding branch2' \
38 "(cd branch2 && cg-update)"
39 test_expect_success
'checking if it was correct' \
40 "(cmp branch1/.git/refs/heads/master branch2/.git/refs/heads/master)"
42 echo "file changed in b2" >branch
2/file-b2
43 test_expect_success
'local commit in branch2' \
44 "(cd branch2 && cg-commit -m\"Local commit in b2 (to-be-fw)\")"
45 test_expect_success
'updating from branch2 in branch1' \
46 "(cd branch1 && cg-update </dev/null)"
47 test_expect_success
'checking for correct merged content' \
48 "(cmp branch2/file-b2 branch1/file-b2)"
49 test_expect_success
'checking if it was a fast-forward' \
50 "(cmp branch1/.git/refs/heads/origin branch1/.git/refs/heads/master)"
52 test_expect_success
'uncommitting in branch2' \
53 "(cd branch2 && cg-admin-uncommit)"
54 echo "file changed 2nd time in b2" >branch
2/file-b2
55 test_expect_success
'local commit in branch2 (rebased)' \
56 "(cd branch2 && cg-commit -m\"Local commit (rebased) in b2 (to-be-fw)\")"
57 test_expect_success
'updating from branch2 in branch1' \
58 "(cd branch1 && cg-update </dev/null)"
59 test_expect_success
'checking for correct merged content' \
60 "(cmp branch2/file-b2 branch1/file-b2)"
61 test_expect_success
'checking if it was still a fast-forward' \
62 "(cmp branch1/.git/refs/heads/origin branch1/.git/refs/heads/master)"