Better diagnostic for wrong branch configuration.
[stgit/ydirson.git] / t / t1800-import.sh
blob8c8c9a009f0184db8f73f9468cd1c3ffc8e3c35b
1 #!/bin/sh
2 # Copyright (c) 2006 Karl Hasselström
3 test_description='Test the import command'
4 . ./test-lib.sh
6 test_expect_success \
7 'Initialize the StGIT repository' \
9 cp ../t1800-import/foo.txt . &&
10 git add foo.txt &&
11 git commit -a -m "initial version" &&
12 stg init
15 test_expect_success \
16 'Apply a patch created with "git diff"' \
18 stg import ../t1800-import/git-diff &&
19 [ $(git cat-file -p $(stg id) \
20 | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
21 stg delete ..
24 test_expect_success \
25 'Apply a patch created with GNU diff' \
27 stg import ../t1800-import/gnu-diff &&
28 [ $(git cat-file -p $(stg id) \
29 | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
30 stg delete ..
33 test_expect_success \
34 'Apply a patch created with "stg export"' \
36 stg import ../t1800-import/stg-export &&
37 [ $(git cat-file -p $(stg id) \
38 | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
39 stg delete ..
42 test_expect_success \
43 'Apply a patch from an 8bit-encoded e-mail' \
45 stg import -m ../t1800-import/email-8bit &&
46 [ $(git cat-file -p $(stg id) \
47 | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
48 [ $(git cat-file -p $(stg id) \
49 | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
50 stg delete ..
53 test_expect_success \
54 'Apply a patch from a QP-encoded e-mail' \
56 stg import -m ../t1800-import/email-qp &&
57 [ $(git cat-file -p $(stg id) \
58 | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
59 [ $(git cat-file -p $(stg id) \
60 | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
61 stg delete ..
64 test_expect_success \
65 'Apply several patches from an mbox file' \
67 stg import -M ../t1800-import/email-mbox &&
68 [ $(git cat-file -p $(stg id change-1) \
69 | grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") = 1 ] &&
70 [ $(git cat-file -p $(stg id change-1) \
71 | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
72 [ $(git cat-file -p $(stg id change-2) \
73 | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] &&
74 [ $(git cat-file -p $(stg id change-2) \
75 | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
76 [ $(git cat-file -p $(stg id change-3) \
77 | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] &&
78 [ $(git cat-file -p $(stg id change-3) \
79 | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
80 stg delete ..
83 test_done