Skip to content

Commit 120e4fc

Browse files
committed
stg import now extracts Message-ID header
Resolves #42 Signed-off-by: Peter Grayson <[email protected]>
1 parent 0095ac3 commit 120e4fc

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

stgit/commands/imprt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def __import_mail_path(mail_path, filename, options):
380380
patch_path = mail_path + '-patch'
381381

382382
mailinfo_lines = (
383-
Run('git', 'mailinfo', msg_path, patch_path)
383+
Run('git', 'mailinfo', '--message-id', msg_path, patch_path)
384384
.encoding(None)
385385
.decoding(None)
386386
.raw_input(mail)

t/t1801-import-email.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ test_expect_success \
2121
| grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
2222
[ $(git cat-file -p $(stg id) \
2323
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
24+
[ $(git cat-file -p $(stg id) \
25+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
2426
stg delete ..
2527
'
2628

@@ -32,6 +34,8 @@ test_expect_success \
3234
| grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
3335
[ $(git cat-file -p $(stg id) \
3436
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
37+
[ $(git cat-file -p $(stg id) \
38+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
3539
stg delete ..
3640
'
3741

@@ -44,6 +48,8 @@ test_expect_success \
4448
| grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
4549
[ $(git cat-file -p $(stg id) \
4650
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
51+
[ $(git cat-file -p $(stg id) \
52+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
4753
stg delete ..
4854
'
4955

@@ -60,6 +66,8 @@ test_expect_success \
6066
| grep -c "tree ecb72e62394189fd2a095047076dab1ae473ed4d") = 1 ] &&
6167
[ $(git cat-file -p $(stg id) \
6268
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
69+
[ $(git cat-file -p $(stg id) \
70+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
6371
stg delete ..
6472
'
6573

@@ -72,6 +80,8 @@ test_expect_success \
7280
| grep -c "tree cf0f9884fdb30bca14d2411e1711f6ae413c9213") = 1 ] &&
7381
[ $(git cat-file -p $(stg id) \
7482
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
83+
[ $(git cat-file -p $(stg id) \
84+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
7585
stg delete ..
7686
'
7787

@@ -83,6 +93,8 @@ test_expect_success \
8393
| grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
8494
[ $(git cat-file -p $(stg id) \
8595
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
96+
[ $(git cat-file -p $(stg id) \
97+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
8698
stg delete ..
8799
'
88100

@@ -94,6 +106,8 @@ test_expect_success \
94106
| grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
95107
[ $(git cat-file -p $(stg id) \
96108
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
109+
[ $(git cat-file -p $(stg id) \
110+
| grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] &&
97111
stg delete ..
98112
'
99113

@@ -105,14 +119,20 @@ test_expect_success \
105119
| grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") = 1 ] &&
106120
[ $(git cat-file -p $(stg id change-1) \
107121
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
122+
[ $(git cat-file -p $(stg id change-1) \
123+
| grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 1 ] &&
108124
[ $(git cat-file -p $(stg id change-2) \
109125
| grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] &&
110126
[ $(git cat-file -p $(stg id change-2) \
111127
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
128+
[ $(git cat-file -p $(stg id change-2) \
129+
| grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 1 ] &&
112130
[ $(git cat-file -p $(stg id change-3-colon) \
113131
| grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] &&
114132
[ $(git cat-file -p $(stg id change-3-colon) \
115133
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
134+
[ $(git cat-file -p $(stg id change-3-colon) \
135+
| grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 1 ] &&
116136
stg delete ..
117137
'
118138

@@ -124,14 +144,20 @@ test_expect_success \
124144
| grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") = 1 ] &&
125145
[ $(git cat-file -p $(stg id change-1) \
126146
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
147+
[ $(git cat-file -p $(stg id change-1) \
148+
| grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 1 ] &&
127149
[ $(git cat-file -p $(stg id change-2) \
128150
| grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] &&
129151
[ $(git cat-file -p $(stg id change-2) \
130152
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
153+
[ $(git cat-file -p $(stg id change-2) \
154+
| grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 1 ] &&
131155
[ $(git cat-file -p $(stg id change-3-colon) \
132156
| grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] &&
133157
[ $(git cat-file -p $(stg id change-3-colon) \
134158
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
159+
[ $(git cat-file -p $(stg id change-3-colon) \
160+
| grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 1 ] &&
135161
stg delete ..
136162
'
137163

@@ -151,14 +177,20 @@ test_expect_success \
151177
| grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") = 1 ] &&
152178
[ $(git cat-file -p $(stg id change-1) \
153179
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
180+
[ $(git cat-file -p $(stg id change-1) \
181+
| grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 1 ] &&
154182
[ $(git cat-file -p $(stg id change-2) \
155183
| grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] &&
156184
[ $(git cat-file -p $(stg id change-2) \
157185
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
186+
[ $(git cat-file -p $(stg id change-2) \
187+
| grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 1 ] &&
158188
[ $(git cat-file -p $(stg id change-3-colon) \
159189
| grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] &&
160190
[ $(git cat-file -p $(stg id change-3-colon) \
161191
| grep -c "author Inge Ström <[email protected]>") = 1 ] &&
192+
[ $(git cat-file -p $(stg id change-3-colon) \
193+
| grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 1 ] &&
162194
stg delete ..
163195
'
164196

0 commit comments

Comments
 (0)