Commit | Line | Data |
---|---|---|
519a11f9 KH |
1 | #!/bin/sh |
2 | # Copyright (c) 2006 Karl Hasselström | |
3 | test_description='Test the assimilate command.' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success \ | |
7 | 'Assimilate in a non-initialized repository' \ | |
ca216016 | 8 | '! stg assimilate' |
519a11f9 KH |
9 | |
10 | test_expect_success \ | |
11 | 'Initialize the StGIT repository' \ | |
12 | 'stg init' | |
13 | ||
14 | test_expect_success \ | |
15 | 'Assimilate in a repository without patches' \ | |
16 | 'stg assimilate' | |
17 | ||
18 | test_expect_success \ | |
19 | 'Create a patch' \ | |
20 | ' | |
21 | stg new foo -m foo && | |
22 | echo foo > foo.txt && | |
23 | stg add foo.txt && | |
24 | stg refresh | |
25 | ' | |
26 | ||
27 | test_expect_success \ | |
28 | 'Assimilate when there is nothing to do' \ | |
29 | 'stg assimilate' | |
30 | ||
31 | test_expect_success \ | |
32 | 'Create a GIT commit' \ | |
33 | ' | |
34 | echo bar > bar.txt && | |
35 | git add bar.txt && | |
36 | git commit -a -m bar | |
37 | ' | |
38 | ||
39 | test_expect_success \ | |
40 | 'Assimilate one GIT commit' \ | |
41 | ' | |
42 | [ $(stg applied | wc -l) -eq 1 ] && | |
43 | stg assimilate && | |
44 | [ $(stg applied | wc -l) -eq 2 ] | |
45 | ' | |
46 | ||
47 | test_expect_success \ | |
48 | 'Create three more GIT commits' \ | |
49 | ' | |
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 | |
57 | ' | |
58 | ||
59 | test_expect_success \ | |
60 | 'Assimilate three GIT commits' \ | |
61 | ' | |
62 | [ $(stg applied | wc -l) -eq 2 ] && | |
63 | stg assimilate && | |
64 | [ $(stg applied | wc -l) -eq 5 ] | |
65 | ' | |
66 | ||
67 | test_expect_success \ | |
a9d090f4 | 68 | 'Create a merge commit' \ |
519a11f9 KH |
69 | ' |
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 | |
76 | ' | |
77 | ||
ca216016 | 78 | test_expect_success 'Assimilate in the presence of a merge commit' ' |
519a11f9 | 79 | [ $(stg applied | wc -l) -eq 5 ] && |
ca216016 KH |
80 | stg assimilate && |
81 | [ $(stg applied | wc -l) -eq 0 ] | |
82 | ' | |
519a11f9 KH |
83 | |
84 | test_done |