Move identification of parent branch's remote def up into stack class.
[stgit] / t / t1301-assimilate.sh
CommitLineData
519a11f9
KH
1#!/bin/sh
2# Copyright (c) 2006 Karl Hasselström
3test_description='Test the assimilate command.'
4. ./test-lib.sh
5
6test_expect_success \
7 'Assimilate in a non-initialized repository' \
8 'stg assimilate'
9
10test_expect_success \
11 'Initialize the StGIT repository' \
12 'stg init'
13
14test_expect_success \
15 'Assimilate in a repository without patches' \
16 'stg assimilate'
17
18test_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
27test_expect_success \
28 'Assimilate when there is nothing to do' \
29 'stg assimilate'
30
31test_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
39test_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
47test_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
59test_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
67test_expect_success \
68 'Create a mege commit' \
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
78test_expect_success \
79 'Try (and fail) to assimilate the merge commit' \
80 '
81 [ $(stg applied | wc -l) -eq 5 ] &&
82 ! stg assimilate &&
83 [ $(stg applied | wc -l) -eq 5 ]
84 '
85
86test_done