Add support to hide and unhide patches
[stgit/ydirson.git] / t / t1301-assimilate.sh
blob26b263c21e2ad669409ce26e450cd3280ae22b84
1 #!/bin/sh
2 # Copyright (c) 2006 Karl Hasselström
3 test_description='Test the assimilate command.'
4 . ./test-lib.sh
6 test_expect_success \
7 'Assimilate in a non-initialized repository' \
8 'stg assimilate'
10 test_expect_success \
11 'Initialize the StGIT repository' \
12 'stg init'
14 test_expect_success \
15 'Assimilate in a repository without patches' \
16 'stg assimilate'
18 test_expect_success \
19 'Create a patch' \
21 stg new foo -m foo &&
22 echo foo > foo.txt &&
23 stg add foo.txt &&
24 stg refresh
27 test_expect_success \
28 'Assimilate when there is nothing to do' \
29 'stg assimilate'
31 test_expect_success \
32 'Create a GIT commit' \
34 echo bar > bar.txt &&
35 git add bar.txt &&
36 git commit -a -m bar
39 test_expect_success \
40 'Assimilate one GIT commit' \
42 [ $(stg applied | wc -l) -eq 1 ] &&
43 stg assimilate &&
44 [ $(stg applied | wc -l) -eq 2 ]
47 test_expect_success \
48 'Create three more GIT commits' \
50 echo one > numbers.txt &&
51 git add numbers.txt &&
52 git commit -a -m one &&
53 echo two >> numbers.txt &&
54 git commit -a -m two &&
55 echo three >> numbers.txt &&
56 git commit -a -m three
59 test_expect_success \
60 'Assimilate three GIT commits' \
62 [ $(stg applied | wc -l) -eq 2 ] &&
63 stg assimilate &&
64 [ $(stg applied | wc -l) -eq 5 ]
67 test_expect_success \
68 'Create a mege commit' \
70 git checkout -b br master^^ &&
71 echo woof > woof.txt &&
72 git add woof.txt &&
73 git commit -a -m woof &&
74 git checkout master &&
75 git pull . br
78 test_expect_success \
79 'Try (and fail) to assimilate the merge commit' \
81 [ $(stg applied | wc -l) -eq 5 ] &&
82 ! stg assimilate &&
83 [ $(stg applied | wc -l) -eq 5 ]
86 test_done