3 # Copyright (c) 2006 Catalin Marinas
6 test_description
='Test the sync command.'
11 'Initialize the StGIT repository' \
17 'Create some patches' \
20 echo foo1 > foo1.txt &&
24 echo foo2 > foo2.txt &&
28 echo foo3 > foo3.txt &&
36 'Create a branch with empty patches' \
38 stg branch -c foo base &&
42 test $(stg applied -c) -eq 3
46 'Synchronise second patch with the master branch' \
48 stg sync -b master p2 &&
49 test $(stg applied -c) -eq 3 &&
50 test $(cat foo2.txt) = "foo2"
54 'Synchronise the first two patches with the master branch' \
56 stg sync -b master -a &&
57 test $(stg applied -c) -eq 3 &&
58 test $(cat foo1.txt) = "foo1" &&
59 test $(cat foo2.txt) = "foo2"
63 'Synchronise all the patches with the exported series' \
65 stg sync -s patches-master/series -a &&
66 test $(stg applied -c) -eq 3 &&
67 test $(cat foo1.txt) = "foo1" &&
68 test $(cat foo2.txt) = "foo2" &&
69 test $(cat foo3.txt) = "foo3"
73 'Modify the master patches' \
77 echo bar1 >> foo1.txt &&
80 echo bar2 > bar2.txt &&
84 echo bar3 >> foo3.txt &&
91 'Synchronise second patch with the master branch' \
93 stg sync -b master p2 &&
94 test $(stg applied -c) -eq 3 &&
95 test $(cat bar2.txt) = "bar2"
99 'Synchronise the first two patches with the master branch (to fail)' \
101 stg sync -b master -a
104 test_expect_success \
105 'Restore the stack status after the failed sync' \
107 test $(stg applied -c) -eq 1 &&
113 test_expect_failure \
114 'Synchronise the third patch with the exported series (to fail)' \
116 stg sync -s patches-master/series p3
119 test_expect_success \
120 'Restore the stack status after the failed sync' \
122 test $(stg applied -c) -eq 3 &&