mailinfo: handle in-body header continuations
[git/git.git] / t / t5100 / sample.mbox
1
2
3
4 From nobody Mon Sep 17 00:00:00 2001
5 From: A (zzz)
6 U
7 Thor
8 <a.u.thor@example.com> (Comment)
9 Date: Fri, 9 Jun 2006 00:44:16 -0700
10 Subject: [PATCH] a commit.
11
12 Here is a patch from A U Thor.
13
14 ---
15 foo | 2 +-
16 1 files changed, 1 insertions(+), 1 deletions(-)
17
18 diff --git a/foo b/foo
19 index 9123cdc..918dcf8 100644
20 --- a/foo
21 +++ b/foo
22 @@ -1 +1 @@
23 -Fri Jun 9 00:44:04 PDT 2006
24 +Fri Jun 9 00:44:13 PDT 2006
25 --
26 1.4.0.g6f2b
27
28 From nobody Mon Sep 17 00:00:00 2001
29 From: A U Thor <a.u.thor@example.com>
30 Date: Fri, 9 Jun 2006 00:44:16 -0700
31 Subject: [PATCH] another patch
32
33 Here is a patch from A U Thor. This addresses the issue raised in the
34 message:
35
36 From: Nit Picker <nit.picker@example.net>
37 Subject: foo is too old
38 Message-Id: <nitpicker.12121212@example.net>
39
40 Hopefully this would fix the problem stated there.
41
42
43 I have included an extra blank line above, but it does not have to be
44 stripped away here, along with the
45 whitespaces at the end of the above line. They are expected to be squashed
46 when the message is made into a commit log by stripspace,
47 Also, there are three blank lines after this paragraph,
48 two truly blank and another full of spaces in between.
49
50
51
52 Hope this helps.
53
54 ---
55 foo | 2 +-
56 1 files changed, 1 insertions(+), 1 deletions(-)
57
58 diff --git a/foo b/foo
59 index 9123cdc..918dcf8 100644
60 --- a/foo
61 +++ b/foo
62 @@ -1 +1 @@
63 -Fri Jun 9 00:44:04 PDT 2006
64 +Fri Jun 9 00:44:13 PDT 2006
65 --
66 1.4.0.g6f2b
67
68 From nobody Mon Sep 17 00:00:00 2001
69 From: Junio C Hamano <junio@kernel.org>
70 Date: Fri, 9 Jun 2006 00:44:16 -0700
71 Subject: re: [PATCH] another patch
72
73 From: A U Thor <a.u.thor@example.com>
74 Subject: [PATCH] third patch
75
76 Here is a patch from A U Thor. This addresses the issue raised in the
77 message:
78
79 From: Nit Picker <nit.picker@example.net>
80 Subject: foo is too old
81 Message-Id: <nitpicker.12121212@example.net>
82
83 Hopefully this would fix the problem stated there.
84
85 ---
86 foo | 2 +-
87 1 files changed, 1 insertions(+), 1 deletions(-)
88
89 diff --git a/foo b/foo
90 index 9123cdc..918dcf8 100644
91 --- a/foo
92 +++ b/foo
93 @@ -1 +1 @@
94 -Fri Jun 9 00:44:04 PDT 2006
95 +Fri Jun 9 00:44:13 PDT 2006
96 --
97 1.4.0.g6f2b
98
99 From nobody Sat Aug 27 23:07:49 2005
100 Path: news.gmane.org!not-for-mail
101 Message-ID: <20050721.091036.01119516.yoshfuji@linux-ipv6.org>
102 From: YOSHIFUJI Hideaki / =?ISO-2022-JP?B?GyRCNUhGIzFRTEAbKEI=?=
103 <yoshfuji@linux-ipv6.org>
104 Newsgroups: gmane.comp.version-control.git
105 Subject: [PATCH 1/2] GIT: Try all addresses for given remote name
106 Date: Thu, 21 Jul 2005 09:10:36 -0400 (EDT)
107 Lines: 99
108 Organization: USAGI/WIDE Project
109 Approved: news@gmane.org
110 NNTP-Posting-Host: main.gmane.org
111 Mime-Version: 1.0
112 Content-Type: Text/Plain; charset=us-ascii
113 Content-Transfer-Encoding: 7bit
114 X-Trace: sea.gmane.org 1121951434 29350 80.91.229.2 (21 Jul 2005 13:10:34 GMT)
115 X-Complaints-To: usenet@sea.gmane.org
116 NNTP-Posting-Date: Thu, 21 Jul 2005 13:10:34 +0000 (UTC)
117
118 Hello.
119
120 Try all addresses for given remote name until it succeeds.
121 Also supports IPv6.
122
123 Signed-of-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
124
125 diff --git a/connect.c b/connect.c
126 --- a/connect.c
127 +++ b/connect.c
128 @@ -96,42 +96,57 @@ static enum protocol get_protocol(const
129 die("I don't handle protocol '%s'", name);
130 }
131
132 -static void lookup_host(const char *host, struct sockaddr *in)
133 -{
134 - struct addrinfo *res;
135 - int ret;
136 -
137 - ret = getaddrinfo(host, NULL, NULL, &res);
138 - if (ret)
139 - die("Unable to look up %s (%s)", host, gai_strerror(ret));
140 - *in = *res->ai_addr;
141 - freeaddrinfo(res);
142 -}
143 +#define STR_(s) # s
144 +#define STR(s) STR_(s)
145
146 static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
147 {
148 - struct sockaddr addr;
149 - int port = DEFAULT_GIT_PORT, sockfd;
150 - char *colon;
151 -
152 - colon = strchr(host, ':');
153 - if (colon) {
154 - char *end;
155 - unsigned long n = strtoul(colon+1, &end, 0);
156 - if (colon[1] && !*end) {
157 - *colon = 0;
158 - port = n;
159 + int sockfd = -1;
160 + char *colon, *end;
161 + char *port = STR(DEFAULT_GIT_PORT);
162 + struct addrinfo hints, *ai0, *ai;
163 + int gai;
164 +
165 + if (host[0] == '[') {
166 + end = strchr(host + 1, ']');
167 + if (end) {
168 + *end = 0;
169 + end++;
170 + host++;
171 + } else
172 + end = host;
173 + } else
174 + end = host;
175 + colon = strchr(end, ':');
176 +
177 + if (colon)
178 + port = colon + 1;
179 +
180 + memset(&hints, 0, sizeof(hints));
181 + hints.ai_socktype = SOCK_STREAM;
182 + hints.ai_protocol = IPPROTO_TCP;
183 +
184 + gai = getaddrinfo(host, port, &hints, &ai);
185 + if (gai)
186 + die("Unable to look up %s (%s)", host, gai_strerror(gai));
187 +
188 + for (ai0 = ai; ai; ai = ai->ai_next) {
189 + sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
190 + if (sockfd < 0)
191 + continue;
192 + if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
193 + close(sockfd);
194 + sockfd = -1;
195 + continue;
196 }
197 + break;
198 }
199
200 - lookup_host(host, &addr);
201 - ((struct sockaddr_in *)&addr)->sin_port = htons(port);
202 + freeaddrinfo(ai0);
203
204 - sockfd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
205 if (sockfd < 0)
206 die("unable to create socket (%s)", strerror(errno));
207 - if (connect(sockfd, (void *)&addr, sizeof(addr)) < 0)
208 - die("unable to connect (%s)", strerror(errno));
209 +
210 fd[0] = sockfd;
211 fd[1] = sockfd;
212 packet_write(sockfd, "%s %s\n", prog, path);
213
214 --
215 YOSHIFUJI Hideaki @ USAGI Project <yoshfuji@linux-ipv6.org>
216 GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
217
218 From nobody Sat Aug 27 23:07:49 2005
219 Path: news.gmane.org!not-for-mail
220 Message-ID: <u5tacjjdpxq.fsf@lysator.liu.se>
221 From: =?ISO8859-1?Q?David_K=E5gedal?= <davidk@lysator.liu.se>
222 Newsgroups: gmane.comp.version-control.git
223 Subject: [PATCH] Fixed two bugs in git-cvsimport-script.
224 Date: Mon, 15 Aug 2005 20:18:25 +0200
225 Lines: 83
226 Approved: news@gmane.org
227 NNTP-Posting-Host: main.gmane.org
228 Mime-Version: 1.0
229 Content-Type: text/plain; charset=ISO8859-1
230 Content-Transfer-Encoding: QUOTED-PRINTABLE
231 X-Trace: sea.gmane.org 1124130247 31839 80.91.229.2 (15 Aug 2005 18:24:07 GMT)
232 X-Complaints-To: usenet@sea.gmane.org
233 NNTP-Posting-Date: Mon, 15 Aug 2005 18:24:07 +0000 (UTC)
234 Cc: "Junio C. Hamano" <junkio@cox.net>
235 Original-X-From: git-owner@vger.kernel.org Mon Aug 15 20:24:05 2005
236
237 The git-cvsimport-script had a copule of small bugs that prevented me
238 from importing a big CVS repository.
239
240 The first was that it didn't handle removed files with a multi-digit
241 primary revision number.
242
243 The second was that it was asking the CVS server for "F" messages,
244 although they were not handled.
245
246 I also updated the documentation for that script to correspond to
247 actual flags.
248
249 Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>
250 ---
251
252 Documentation/git-cvsimport-script.txt | 9 ++++++++-
253 git-cvsimport-script | 4 ++--
254 2 files changed, 10 insertions(+), 3 deletions(-)
255
256 50452f9c0c2df1f04d83a26266ba704b13861632
257 diff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git=
258 -cvsimport-script.txt
259 --- a/Documentation/git-cvsimport-script.txt
260 +++ b/Documentation/git-cvsimport-script.txt
261 @@ -29,6 +29,10 @@ OPTIONS
262 currently, only the :local:, :ext: and :pserver: access methods=20
263 are supported.
264 =20
265 +-C <target-dir>::
266 + The GIT repository to import to. If the directory doesn't
267 + exist, it will be created. Default is the current directory.
268 +
269 -i::
270 Import-only: don't perform a checkout after importing. This option
271 ensures the working directory and cache remain untouched and will
272 @@ -44,7 +48,7 @@ OPTIONS
273 =20
274 -p <options-for-cvsps>::
275 Additional options for cvsps.
276 - The options '-x' and '-A' are implicit and should not be used here.
277 + The options '-u' and '-A' are implicit and should not be used here.
278 =20
279 If you need to pass multiple options, separate them with a comma.
280 =20
281 @@ -57,6 +61,9 @@ OPTIONS
282 -h::
283 Print a short usage message and exit.
284 =20
285 +-z <fuzz>::
286 + Pass the timestamp fuzz factor to cvsps.
287 +
288 OUTPUT
289 ------
290 If '-v' is specified, the script reports what it is doing.
291 diff --git a/git-cvsimport-script b/git-cvsimport-script
292 --- a/git-cvsimport-script
293 +++ b/git-cvsimport-script
294 @@ -190,7 +190,7 @@ sub conn {
295 $self->{'socketo'}->write("Root $repo\n");
296 =20
297 # Trial and error says that this probably is the minimum set
298 - $self->{'socketo'}->write("Valid-responses ok error Valid-requests Mo=
299 de M Mbinary E F Checked-in Created Updated Merged Removed\n");
300 + $self->{'socketo'}->write("Valid-responses ok error Valid-requests Mo=
301 de M Mbinary E Checked-in Created Updated Merged Removed\n");
302 =20
303 $self->{'socketo'}->write("valid-requests\n");
304 $self->{'socketo'}->flush();
305 @@ -691,7 +691,7 @@ while(<CVS>) {
306 unlink($tmpname);
307 my $mode =3D pmode($cvs->{'mode'});
308 push(@new,[$mode, $sha, $fn]); # may be resurrected!
309 - } elsif($state =3D=3D 9 and /^\s+(\S+):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(=
310 DEAD\)\s*$/) {
311 + } elsif($state =3D=3D 9 and /^\s+(\S+):\d+(?:\.\d+)+->(\d+(?:\.\d+)+)=
312 \(DEAD\)\s*$/) {
313 my $fn =3D $1;
314 $fn =3D~ s#^/+##;
315 push(@old,$fn);
316
317 --=20
318 David K=E5gedal
319 -
320 To unsubscribe from this list: send the line "unsubscribe git" in
321 the body of a message to majordomo@vger.kernel.org
322 More majordomo info at http://vger.kernel.org/majordomo-info.html
323
324 From nobody Mon Sep 17 00:00:00 2001
325 From: A U Thor <a.u.thor@example.com>
326 References: <Pine.LNX.4.640.0001@woody.linux-foundation.org>
327 <Pine.LNX.4.640.0002@woody.linux-foundation.org>
328 <Pine.LNX.4.640.0003@woody.linux-foundation.org>
329 <Pine.LNX.4.640.0004@woody.linux-foundation.org>
330 <Pine.LNX.4.640.0005@woody.linux-foundation.org>
331 <Pine.LNX.4.640.0006@woody.linux-foundation.org>
332 <Pine.LNX.4.640.0007@woody.linux-foundation.org>
333 <Pine.LNX.4.640.0008@woody.linux-foundation.org>
334 <Pine.LNX.4.640.0009@woody.linux-foundation.org>
335 <Pine.LNX.4.640.0010@woody.linux-foundation.org>
336 <Pine.LNX.4.640.0011@woody.linux-foundation.org>
337 <Pine.LNX.4.640.0012@woody.linux-foundation.org>
338 <Pine.LNX.4.640.0013@woody.linux-foundation.org>
339 <Pine.LNX.4.640.0014@woody.linux-foundation.org>
340 <Pine.LNX.4.640.0015@woody.linux-foundation.org>
341 <Pine.LNX.4.640.0016@woody.linux-foundation.org>
342 <Pine.LNX.4.640.0017@woody.linux-foundation.org>
343 <Pine.LNX.4.640.0018@woody.linux-foundation.org>
344 <Pine.LNX.4.640.0019@woody.linux-foundation.org>
345 <Pine.LNX.4.640.0020@woody.linux-foundation.org>
346 <Pine.LNX.4.640.0021@woody.linux-foundation.org>
347 <Pine.LNX.4.640.0022@woody.linux-foundation.org>
348 <Pine.LNX.4.640.0023@woody.linux-foundation.org>
349 <Pine.LNX.4.640.0024@woody.linux-foundation.org>
350 <Pine.LNX.4.640.0025@woody.linux-foundation.org>
351 <Pine.LNX.4.640.0026@woody.linux-foundation.org>
352 <Pine.LNX.4.640.0027@woody.linux-foundation.org>
353 <Pine.LNX.4.640.0028@woody.linux-foundation.org>
354 <Pine.LNX.4.640.0029@woody.linux-foundation.org>
355 <Pine.LNX.4.640.0030@woody.linux-foundation.org>
356 <Pine.LNX.4.640.0031@woody.linux-foundation.org>
357 <Pine.LNX.4.640.0032@woody.linux-foundation.org>
358 <Pine.LNX.4.640.0033@woody.linux-foundation.org>
359 <Pine.LNX.4.640.0034@woody.linux-foundation.org>
360 <Pine.LNX.4.640.0035@woody.linux-foundation.org>
361 <Pine.LNX.4.640.0036@woody.linux-foundation.org>
362 <Pine.LNX.4.640.0037@woody.linux-foundation.org>
363 <Pine.LNX.4.640.0038@woody.linux-foundation.org>
364 <Pine.LNX.4.640.0039@woody.linux-foundation.org>
365 <Pine.LNX.4.640.0040@woody.linux-foundation.org>
366 <Pine.LNX.4.640.0041@woody.linux-foundation.org>
367 <Pine.LNX.4.640.0042@woody.linux-foundation.org>
368 <Pine.LNX.4.640.0043@woody.linux-foundation.org>
369 <Pine.LNX.4.640.0044@woody.linux-foundation.org>
370 <Pine.LNX.4.640.0045@woody.linux-foundation.org>
371 <Pine.LNX.4.640.0046@woody.linux-foundation.org>
372 <Pine.LNX.4.640.0047@woody.linux-foundation.org>
373 <Pine.LNX.4.640.0048@woody.linux-foundation.org>
374 <Pine.LNX.4.640.0049@woody.linux-foundation.org>
375 <Pine.LNX.4.640.0050@woody.linux-foundation.org>
376 Date: Fri, 9 Jun 2006 00:44:16 -0700
377 Subject: [PATCH] a commit.
378
379 Here is a patch from A U Thor.
380
381 ---
382 foo | 2 +-
383 1 files changed, 1 insertions(+), 1 deletions(-)
384
385 diff --git a/foo b/foo
386 index 9123cdc..918dcf8 100644
387 --- a/foo
388 +++ b/foo
389 @@ -1 +1 @@
390 -Fri Jun 9 00:44:04 PDT 2006
391 +Fri Jun 9 00:44:13 PDT 2006
392 --
393 1.4.0.g6f2b
394
395 From nobody Mon Sep 17 00:00:00 2001
396 From: A U Thor <a.u.thor@example.com>
397 Date: Fri, 9 Jun 2006 00:44:16 -0700
398 Subject: [PATCH] another patch
399
400 Here is an empty patch from A U Thor.
401
402 From nobody Mon Sep 17 00:00:00 2001
403 From: Junio C Hamano <junio@kernel.org>
404 Date: Fri, 9 Jun 2006 00:44:16 -0700
405 Subject: re: [PATCH] another patch
406
407 From: A U Thor <a.u.thor@example.com>
408 Subject: [PATCH] another patch
409 >Here is an empty patch from A U Thor.
410
411 Hey you forgot the patch!
412
413 From nobody Mon Sep 17 00:00:00 2001
414 From: A U Thor <a.u.thor@example.com>
415 Date: Mon, 17 Sep 2001 00:00:00 +0900
416 Mime-Version: 1.0
417 Content-Type: Text/Plain; charset=us-ascii
418 Content-Transfer-Encoding: Quoted-Printable
419
420 =0A=0AFrom: F U Bar <f.u.bar@example.com>
421 Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
422
423 diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
424 index b426a14..97756ec 100644
425 --- a/Documentation/diff-format.txt
426 +++ b/Documentation/diff-format.txt
427 @@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
428 environment variable 'GIT_DIFF_OPTS'. For example, if you
429 prefer context diff:
430 =20
431 - GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
432 + GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
433 =20
434 =20
435 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
436 From b9704a518e21158433baa2cc2d591fea687967f6 Mon Sep 17 00:00:00 2001
437 From: =?UTF-8?q?Lukas=20Sandstr=C3=B6m?= <lukass@etek.chalmers.se>
438 Date: Thu, 10 Jul 2008 23:41:33 +0200
439 Subject: Re: discussion that lead to this patch
440 MIME-Version: 1.0
441 Content-Type: text/plain; charset=UTF-8
442 Content-Transfer-Encoding: 8bit
443
444 [PATCH] git-mailinfo: Fix getting the subject from the body
445
446 "Subject: " isn't in the static array "header", and thus
447 memcmp("Subject: ", header[i], 7) will never match.
448
449 Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
450 Signed-off-by: Junio C Hamano <gitster@pobox.com>
451 ---
452 builtin-mailinfo.c | 2 +-
453 1 files changed, 1 insertions(+), 1 deletions(-)
454
455 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
456 index 962aa34..2d1520f 100644
457 --- a/builtin-mailinfo.c
458 +++ b/builtin-mailinfo.c
459 @@ -334,7 +334,7 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over
460 return 1;
461 if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) {
462 for (i = 0; header[i]; i++) {
463 - if (!memcmp("Subject: ", header[i], 9)) {
464 + if (!memcmp("Subject", header[i], 7)) {
465 if (! handle_header(line, hdr_data[i], 0)) {
466 return 1;
467 }
468 --
469 1.5.6.2.455.g1efb2
470
471 From nobody Fri Aug 8 22:24:03 2008
472 Date: Fri, 8 Aug 2008 13:08:37 +0200 (CEST)
473 From: A U Thor <a.u.thor@example.com>
474 Subject: [PATCH 3/3 v2] Xyzzy
475 MIME-Version: 1.0
476 Content-Type: multipart/mixed; boundary="=-=-="
477
478 --=-=-=
479 Content-Type: text/plain; charset=ISO8859-15
480 Content-Transfer-Encoding: quoted-printable
481
482 Here comes a commit log message, and
483 its second line is here.
484 ---
485 builtin-mailinfo.c | 4 ++--
486
487 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
488 index 3e5fe51..aabfe5c 100644
489 --- a/builtin-mailinfo.c
490 +++ b/builtin-mailinfo.c
491 @@ -758,8 +758,8 @@ static void handle_body(void)
492 /* process any boundary lines */
493 if (*content_top && is_multipart_boundary(&line)) {
494 /* flush any leftover */
495 - if (line.len)
496 - handle_filter(&line);
497 + if (prev.len)
498 + handle_filter(&prev);
499 =20
500 if (!handle_boundary())
501 goto handle_body_out;
502 --=20
503 1.6.0.rc2
504
505 --=-=-=--
506
507 From bda@mnsspb.ru Wed Nov 12 17:54:41 2008
508 From: Dmitriy Blinov <bda@mnsspb.ru>
509 To: navy-patches@dinar.mns.mnsspb.ru
510 Date: Wed, 12 Nov 2008 17:54:41 +0300
511 Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
512 X-Mailer: git-send-email 1.5.6.5
513 MIME-Version: 1.0
514 Content-Type: text/plain;
515 charset=utf-8
516 Content-Transfer-Encoding: 8bit
517 Subject: [Navy-patches] [PATCH]
518 =?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
519 =?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
520 =?utf-8?b?0YHQsdC+0YDQutC4?=
521
522 textlive-* исправлены на texlive-*
523 docutils заменён на python-docutils
524
525 Действительно, оказалось, что rest2web вытягивает за собой
526 python-docutils. В то время как сам rest2web не нужен.
527
528 Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
529 ---
530 howto/build_navy.txt | 6 +++---
531 1 files changed, 3 insertions(+), 3 deletions(-)
532
533 diff --git a/howto/build_navy.txt b/howto/build_navy.txt
534 index 3fd3afb..0ee807e 100644
535 --- a/howto/build_navy.txt
536 +++ b/howto/build_navy.txt
537 @@ -119,8 +119,8 @@
538 - libxv-dev
539 - libusplash-dev
540 - latex-make
541 - - textlive-lang-cyrillic
542 - - textlive-latex-extra
543 + - texlive-lang-cyrillic
544 + - texlive-latex-extra
545 - dia
546 - python-pyrex
547 - libtool
548 @@ -128,7 +128,7 @@
549 - sox
550 - cython
551 - imagemagick
552 - - docutils
553 + - python-docutils
554
555 #. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev
556 #. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::
557 --
558 1.5.6.5
559 From nobody Mon Sep 17 00:00:00 2001
560 From: <a.u.thor@example.com> (A U Thor)
561 Date: Fri, 9 Jun 2006 00:44:16 -0700
562 Subject: [PATCH] a patch
563
564 From nobody Mon Sep 17 00:00:00 2001
565 From: Junio Hamano <junkio@cox.net>
566 Date: Thu, 20 Aug 2009 17:18:22 -0700
567 Subject: Why doesn't git-am does not like >8 scissors mark?
568
569 Subject: [PATCH] BLAH ONE
570
571 In real life, we will see a discussion that inspired this patch
572 discussing related and unrelated things around >8 scissors mark
573 in this part of the message.
574
575 Subject: [PATCH] BLAH TWO
576
577 And then we will see the scissors.
578
579 This line is not a scissors mark -- >8 -- but talks about it.
580 - - >8 - - please remove everything above this line - - >8 - -
581
582 Subject: [PATCH] Teach mailinfo to ignore everything before -- >8 -- mark
583 From: Junio C Hamano <gitster@pobox.com>
584
585 This teaches mailinfo the scissors -- >8 -- mark; the command ignores
586 everything before it in the message body.
587
588 Signed-off-by: Junio C Hamano <gitster@pobox.com>
589 ---
590 builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
591 1 files changed, 36 insertions(+), 1 deletions(-)
592
593 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
594 index b0b5d8f..461c47e 100644
595 --- a/builtin-mailinfo.c
596 +++ b/builtin-mailinfo.c
597 @@ -712,6 +712,34 @@ static inline int patchbreak(const struct strbuf *line)
598 return 0;
599 }
600
601 +static int scissors(const struct strbuf *line)
602 +{
603 + size_t i, len = line->len;
604 + int scissors_dashes_seen = 0;
605 + const char *buf = line->buf;
606 +
607 + for (i = 0; i < len; i++) {
608 + if (isspace(buf[i]))
609 + continue;
610 + if (buf[i] == '-') {
611 + scissors_dashes_seen |= 02;
612 + continue;
613 + }
614 + if (i + 1 < len && !memcmp(buf + i, ">8", 2)) {
615 + scissors_dashes_seen |= 01;
616 + i++;
617 + continue;
618 + }
619 + if (i + 7 < len && !memcmp(buf + i, "cut here", 8)) {
620 + i += 7;
621 + continue;
622 + }
623 + /* everything else --- not scissors */
624 + break;
625 + }
626 + return scissors_dashes_seen == 03;
627 +}
628 +
629 static int handle_commit_msg(struct strbuf *line)
630 {
631 static int still_looking = 1;
632 @@ -723,10 +751,17 @@ static int handle_commit_msg(struct strbuf *line)
633 strbuf_ltrim(line);
634 if (!line->len)
635 return 0;
636 - if ((still_looking = check_header(line, s_hdr_data, 0)) != 0)
637 + still_looking = check_header(line, s_hdr_data, 0);
638 + if (still_looking)
639 return 0;
640 }
641
642 + if (scissors(line)) {
643 + fseek(cmitmsg, 0L, SEEK_SET);
644 + still_looking = 1;
645 + return 0;
646 + }
647 +
648 /* normalize the log message to UTF-8. */
649 if (metainfo_charset)
650 convert_to_utf8(line, charset.buf);
651 --
652 1.6.4.1
653 From nobody Mon Sep 17 00:00:00 2001
654 From: A U Thor <a.u.thor@example.com>
655 Subject: check bogus body header (from)
656 Date: Fri, 9 Jun 2006 00:44:16 -0700
657
658 From: bogosity
659 - a list
660 - of stuff
661 ---
662 diff --git a/foo b/foo
663 index e69de29..d95f3ad 100644
664 --- a/foo
665 +++ b/foo
666 @@ -0,0 +1 @@
667 +content
668
669 From nobody Mon Sep 17 00:00:00 2001
670 From: A U Thor <a.u.thor@example.com>
671 Subject: check bogus body header (date)
672 Date: Fri, 9 Jun 2006 00:44:16 -0700
673
674 Date: bogus
675
676 and some content
677
678 ---
679 diff --git a/foo b/foo
680 index e69de29..d95f3ad 100644
681 --- a/foo
682 +++ b/foo
683 @@ -0,0 +1 @@
684 +content
685
686 From nobody Mon Sep 17 00:00:00 2001
687 From: A U Thor <a.u.thor@example.com>
688 Subject: A E I O U
689 Date: Mon, 17 Sep 2012 14:23:44 -0700
690 MIME-Version: 1.0
691 Content-Type: text/plain; charset="iso-2022-jp"
692 Content-type: text/plain; charset="UTF-8"
693
694 New content here
695
696 diff --git a/foo b/foo
697 index e69de29..d95f3ad 100644
698 --- a/foo
699 +++ b/foo
700 @@ -0,0 +1 @@
701 +New content
702 From nobody Mon Sep 17 00:00:00 2001
703 From: A U Thor <a.u.thor@example.com>
704 Subject: check multiline inbody headers
705 Date: Fri, 9 Jun 2006 00:44:16 -0700
706
707 From: Another Thor
708 <a.thor@example.com>
709 Subject: This one contains
710 a tab
711 and a space
712
713 a commit message
714
715 diff --git a/foo b/foo
716 index e69de29..d95f3ad 100644
717 --- a/foo
718 +++ b/foo
719 @@ -0,0 +1 @@
720 +content