submodule: Use cat instead of echo to avoid DOS line-endings
[git/dscho.git] / t / t5100 / sample.mbox
blob8b2ae064c36b969ca20324154cea66bf26739de6
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.
12 Here is a patch from A U Thor.
14 ---
15  foo | 2 +-
16  1 files changed, 1 insertions(+), 1 deletions(-)
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
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
33 Here is a patch from A U Thor.  This addresses the issue raised in the
34 message:
36 From: Nit Picker <nit.picker@example.net>
37 Subject: foo is too old
38 Message-Id: <nitpicker.12121212@example.net>
40 Hopefully this would fix the problem stated there.
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.
50             
52 Hope this helps.
54 ---
55  foo | 2 +-
56  1 files changed, 1 insertions(+), 1 deletions(-)
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
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
73 From: A U Thor <a.u.thor@example.com>
74 Subject: [PATCH] third patch
76 Here is a patch from A U Thor.  This addresses the issue raised in the
77 message:
79 From: Nit Picker <nit.picker@example.net>
80 Subject: foo is too old
81 Message-Id: <nitpicker.12121212@example.net>
83 Hopefully this would fix the problem stated there.
85 ---
86  foo | 2 +-
87  1 files changed, 1 insertions(+), 1 deletions(-)
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
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)
118 Hello.
120 Try all addresses for given remote name until it succeeds.
121 Also supports IPv6.
123 Signed-of-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
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);
132 -static void lookup_host(const char *host, struct sockaddr *in)
134 -       struct addrinfo *res;
135 -       int ret;
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);
143 +#define STR_(s)        # s
144 +#define STR(s) STR_(s)
146  static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
148 -       struct sockaddr addr;
149 -       int port = DEFAULT_GIT_PORT, sockfd;
150 -       char *colon;
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;
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, ':');
177 +       if (colon)
178 +               port = colon + 1;
180 +       memset(&hints, 0, sizeof(hints));
181 +       hints.ai_socktype = SOCK_STREAM;
182 +       hints.ai_protocol = IPPROTO_TCP;
184 +       gai = getaddrinfo(host, port, &hints, &ai);
185 +       if (gai)
186 +               die("Unable to look up %s (%s)", host, gai_strerror(gai));
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         }
200 -       lookup_host(host, &addr);
201 -       ((struct sockaddr_in *)&addr)->sin_port = htons(port);
202 +       freeaddrinfo(ai0);
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));
210         fd[0] = sockfd;
211         fd[1] = sockfd;
212         packet_write(sockfd, "%s %s\n", prog, path);
214 -- 
215 YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
216 GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
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
237 The git-cvsimport-script had a copule of small bugs that prevented me
238 from importing a big CVS repository.
240 The first was that it didn't handle removed files with a multi-digit
241 primary revision number.
243 The second was that it was asking the CVS server for "F" messages,
244 although they were not handled.
246 I also updated the documentation for that script to correspond to
247 actual flags.
249 Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>
252  Documentation/git-cvsimport-script.txt | 9 ++++++++-
253  git-cvsimport-script                   | 4 ++--
254  2 files changed, 10 insertions(+), 3 deletions(-)
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.
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.
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
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.
279         If you need to pass multiple options, separate them with a comma.
281 @@ -57,6 +61,9 @@ OPTIONS
282  -h::
283         Print a short usage message and exit.
285 +-z <fuzz>::
286 +        Pass the timestamp fuzz factor to cvsps.
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");
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");
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);
317 --=20
318 David K=E5gedal
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
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.
379 Here is a patch from A U Thor.
382  foo | 2 +-
383  1 files changed, 1 insertions(+), 1 deletions(-)
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
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
400 Here is an empty patch from A U Thor.
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
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.
411 Hey you forgot the patch!
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
420 =0A=0AFrom: F U Bar <f.u.bar@example.com>
421 Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
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:
431 -      GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
432 +      GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
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
444 [PATCH] git-mailinfo: Fix getting the subject from the body
446 "Subject: " isn't in the static array "header", and thus
447 memcmp("Subject: ", header[i], 7) will never match.
449 Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
450 Signed-off-by: Junio C Hamano <gitster@pobox.com>
452  builtin-mailinfo.c | 2 +-
453  1 files changed, 1 insertions(+), 1 deletions(-)
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
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="=-=-="
478 --=-=-=
479 Content-Type: text/plain; charset=ISO8859-15
480 Content-Transfer-Encoding: quoted-printable
482 Here comes a commit log message, and
483 its second line is here.
485  builtin-mailinfo.c  | 4 ++--
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);
500                         if (!handle_boundary())
501                                 goto handle_body_out;
502 --=20
503 1.6.0.rc2
505 --=-=-=--
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?=
522 textlive-* исправлены на texlive-*
523 docutils заменён на python-docutils
525 Действительно, оказалось, что rest2web вытягивает за собой
526 python-docutils. В то время как сам rest2web не нужен.
528 Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
530  howto/build_navy.txt |    6 +++---
531  1 files changed, 3 insertions(+), 3 deletions(-)
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
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
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?
569 Subject: [PATCH] BLAH ONE
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.
575 Subject: [PATCH] BLAH TWO
577 And then we will see the scissors.
579  This line is not a scissors mark -- >8 -- but talks about it.
580  - - >8 - - please remove everything above this line - - >8 - -
582 Subject: [PATCH] Teach mailinfo to ignore everything before -- >8 -- mark
583 From: Junio C Hamano <gitster@pobox.com>
585 This teaches mailinfo the scissors -- >8 -- mark; the command ignores
586 everything before it in the message body.
588 Signed-off-by: Junio C Hamano <gitster@pobox.com>
590  builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
591  1 files changed, 36 insertions(+), 1 deletions(-)
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;
601 +static int scissors(const struct strbuf *line)
603 +       size_t i, len = line->len;
604 +       int scissors_dashes_seen = 0;
605 +       const char *buf = line->buf;
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;
629  static int handle_commit_msg(struct strbuf *line)
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         }
642 +       if (scissors(line)) {
643 +               fseek(cmitmsg, 0L, SEEK_SET);
644 +               still_looking = 1;
645 +               return 0;
646 +       }
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
658 From: bogosity
659   - a list
660   - of stuff
662 diff --git a/foo b/foo
663 index e69de29..d95f3ad 100644
664 --- a/foo
665 +++ b/foo
666 @@ -0,0 +1 @@
667 +content
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
674 Date: bogus
676 and some content
679 diff --git a/foo b/foo
680 index e69de29..d95f3ad 100644
681 --- a/foo
682 +++ b/foo
683 @@ -0,0 +1 @@
684 +content
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"
694 New content here
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