1
2
3
4From nobody Mon Sep 17 00:00:00 2001
5From: A (zzz)
6      U
7      Thor
8      <a.u.thor@example.com> (Comment)
9Date: Fri, 9 Jun 2006 00:44:16 -0700
10Subject: [PATCH] a commit.
11
12Here is a patch from A U Thor.
13
14---
15 foo | 2 +-
16 1 files changed, 1 insertions(+), 1 deletions(-)
17
18diff --git a/foo b/foo
19index 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--
261.4.0.g6f2b
27
28From nobody Mon Sep 17 00:00:00 2001
29From: A U Thor <a.u.thor@example.com>
30Date: Fri, 9 Jun 2006 00:44:16 -0700
31Subject: [PATCH] another patch
32
33Here is a patch from A U Thor.  This addresses the issue raised in the
34message:
35
36From: Nit Picker <nit.picker@example.net>
37Subject: foo is too old
38Message-Id: <nitpicker.12121212@example.net>
39
40Hopefully this would fix the problem stated there.
41
42
43I have included an extra blank line above, but it does not have to be
44stripped away here, along with the
45whitespaces at the end of the above line.  They are expected to be squashed
46when the message is made into a commit log by stripspace,
47Also, there are three blank lines after this paragraph,
48two truly blank and another full of spaces in between.
49
50
51
52Hope this helps.
53
54---
55 foo | 2 +-
56 1 files changed, 1 insertions(+), 1 deletions(-)
57
58diff --git a/foo b/foo
59index 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--
661.4.0.g6f2b
67
68From nobody Mon Sep 17 00:00:00 2001
69From: Junio C Hamano <junio@kernel.org>
70Date: Fri, 9 Jun 2006 00:44:16 -0700
71Subject: re: [PATCH] another patch
72
73From: A U Thor <a.u.thor@example.com>
74Subject: [PATCH] third patch
75
76Here is a patch from A U Thor.  This addresses the issue raised in the
77message:
78
79From: Nit Picker <nit.picker@example.net>
80Subject: foo is too old
81Message-Id: <nitpicker.12121212@example.net>
82
83Hopefully this would fix the problem stated there.
84
85---
86 foo | 2 +-
87 1 files changed, 1 insertions(+), 1 deletions(-)
88
89diff --git a/foo b/foo
90index 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--
971.4.0.g6f2b
98
99From nobody Sat Aug 27 23:07:49 2005
100Path: news.gmane.org!not-for-mail
101Message-ID: <20050721.091036.01119516.yoshfuji@linux-ipv6.org>
102From: YOSHIFUJI Hideaki / =?ISO-2022-JP?B?GyRCNUhGIzFRTEAbKEI=?=
103	<yoshfuji@linux-ipv6.org>
104Newsgroups: gmane.comp.version-control.git
105Subject: [PATCH 1/2] GIT: Try all addresses for given remote name
106Date: Thu, 21 Jul 2005 09:10:36 -0400 (EDT)
107Lines: 99
108Organization: USAGI/WIDE Project
109Approved: news@gmane.org
110NNTP-Posting-Host: main.gmane.org
111Mime-Version: 1.0
112Content-Type: Text/Plain; charset=us-ascii
113Content-Transfer-Encoding: 7bit
114X-Trace: sea.gmane.org 1121951434 29350 80.91.229.2 (21 Jul 2005 13:10:34 GMT)
115X-Complaints-To: usenet@sea.gmane.org
116NNTP-Posting-Date: Thu, 21 Jul 2005 13:10:34 +0000 (UTC)
117
118Hello.
119
120Try all addresses for given remote name until it succeeds.
121Also supports IPv6.
122
123Signed-of-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
124
125diff --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--
215YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
216GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
217
218From nobody Sat Aug 27 23:07:49 2005
219Path: news.gmane.org!not-for-mail
220Message-ID: <u5tacjjdpxq.fsf@lysator.liu.se>
221From: =?ISO8859-1?Q?David_K=E5gedal?= <davidk@lysator.liu.se>
222Newsgroups: gmane.comp.version-control.git
223Subject: [PATCH] Fixed two bugs in git-cvsimport-script.
224Date: Mon, 15 Aug 2005 20:18:25 +0200
225Lines: 83
226Approved: news@gmane.org
227NNTP-Posting-Host: main.gmane.org
228Mime-Version: 1.0
229Content-Type: text/plain; charset=ISO8859-1
230Content-Transfer-Encoding: QUOTED-PRINTABLE
231X-Trace: sea.gmane.org 1124130247 31839 80.91.229.2 (15 Aug 2005 18:24:07 GMT)
232X-Complaints-To: usenet@sea.gmane.org
233NNTP-Posting-Date: Mon, 15 Aug 2005 18:24:07 +0000 (UTC)
234Cc: "Junio C. Hamano" <junkio@cox.net>
235Original-X-From: git-owner@vger.kernel.org Mon Aug 15 20:24:05 2005
236
237The git-cvsimport-script had a copule of small bugs that prevented me
238from importing a big CVS repository.
239
240The first was that it didn't handle removed files with a multi-digit
241primary revision number.
242
243The second was that it was asking the CVS server for "F" messages,
244although they were not handled.
245
246I also updated the documentation for that script to correspond to
247actual flags.
248
249Signed-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
25650452f9c0c2df1f04d83a26266ba704b13861632
257diff --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.
291diff --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=
299de M Mbinary E F Checked-in Created Updated Merged Removed\n");
300+	$self->{'socketo'}->write("Valid-responses ok error Valid-requests Mo=
301de 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+)+)\(=
310DEAD\)\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
318David K=E5gedal
319-
320To unsubscribe from this list: send the line "unsubscribe git" in
321the body of a message to majordomo@vger.kernel.org
322More majordomo info at  http://vger.kernel.org/majordomo-info.html
323
324From nobody Mon Sep 17 00:00:00 2001
325From: A U Thor <a.u.thor@example.com>
326References: <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>
376Date: Fri, 9 Jun 2006 00:44:16 -0700
377Subject: [PATCH] a commit.
378
379Here is a patch from A U Thor.
380
381---
382 foo | 2 +-
383 1 files changed, 1 insertions(+), 1 deletions(-)
384
385diff --git a/foo b/foo
386index 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--
3931.4.0.g6f2b
394
395From nobody Mon Sep 17 00:00:00 2001
396From: A U Thor <a.u.thor@example.com>
397Date: Fri, 9 Jun 2006 00:44:16 -0700
398Subject: [PATCH] another patch
399
400Here is an empty patch from A U Thor.
401
402From nobody Mon Sep 17 00:00:00 2001
403From: Junio C Hamano <junio@kernel.org>
404Date: Fri, 9 Jun 2006 00:44:16 -0700
405Subject: re: [PATCH] another patch
406
407From: A U Thor <a.u.thor@example.com>
408Subject: [PATCH] another patch
409>Here is an empty patch from A U Thor.
410
411Hey you forgot the patch!
412
413From nobody Mon Sep 17 00:00:00 2001
414From: A U Thor <a.u.thor@example.com>
415Date: Mon, 17 Sep 2001 00:00:00 +0900
416Mime-Version: 1.0
417Content-Type: Text/Plain; charset=us-ascii
418Content-Transfer-Encoding: Quoted-Printable
419
420=0A=0AFrom: F U Bar <f.u.bar@example.com>
421Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
422
423diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
424index 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
436From b9704a518e21158433baa2cc2d591fea687967f6 Mon Sep 17 00:00:00 2001
437From: =?UTF-8?q?Lukas=20Sandstr=C3=B6m?= <lukass@etek.chalmers.se>
438Date: Thu, 10 Jul 2008 23:41:33 +0200
439Subject: Re: discussion that lead to this patch
440MIME-Version: 1.0
441Content-Type: text/plain; charset=UTF-8
442Content-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
447memcmp("Subject: ", header[i], 7) will never match.
448
449Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
450Signed-off-by: Junio C Hamano <gitster@pobox.com>
451---
452 builtin-mailinfo.c | 2 +-
453 1 files changed, 1 insertions(+), 1 deletions(-)
454
455diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
456index 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--
4691.5.6.2.455.g1efb2
470
471From nobody Fri Aug  8 22:24:03 2008
472Date: Fri, 8 Aug 2008 13:08:37 +0200 (CEST)
473From: A U Thor <a.u.thor@example.com>
474Subject: [PATCH 3/3 v2] Xyzzy
475MIME-Version: 1.0
476Content-Type: multipart/mixed; boundary="=-=-="
477
478--=-=-=
479Content-Type: text/plain; charset=ISO8859-15
480Content-Transfer-Encoding: quoted-printable
481
482Here comes a commit log message, and
483its second line is here.
484---
485 builtin-mailinfo.c  | 4 ++--
486
487diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
488index 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
5031.6.0.rc2
504
505--=-=-=--
506
507From bda@mnsspb.ru Wed Nov 12 17:54:41 2008
508From: Dmitriy Blinov <bda@mnsspb.ru>
509To: navy-patches@dinar.mns.mnsspb.ru
510Date: Wed, 12 Nov 2008 17:54:41 +0300
511Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
512X-Mailer: git-send-email 1.5.6.5
513MIME-Version: 1.0
514Content-Type: text/plain;
515  charset=utf-8
516Content-Transfer-Encoding: 8bit
517Subject: [Navy-patches] [PATCH]
518	=?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
519	=?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
520	=?utf-8?b?0YHQsdC+0YDQutC4?=
521
522textlive-* исправлены на texlive-*
523docutils заменён на python-docutils
524
525Действительно, оказалось, что rest2web вытягивает за собой
526python-docutils. В то время как сам rest2web не нужен.
527
528Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
529---
530 howto/build_navy.txt |    6 +++---
531 1 files changed, 3 insertions(+), 3 deletions(-)
532
533diff --git a/howto/build_navy.txt b/howto/build_navy.txt
534index 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--
5581.5.6.5
559From nobody Mon Sep 17 00:00:00 2001
560From: <a.u.thor@example.com> (A U Thor)
561Date: Fri, 9 Jun 2006 00:44:16 -0700
562Subject: [PATCH] a patch
563
564From nobody Mon Sep 17 00:00:00 2001
565From: Junio Hamano <junkio@cox.net>
566Date: Thu, 20 Aug 2009 17:18:22 -0700
567Subject: Why doesn't git-am does not like >8 scissors mark?
568
569Subject: [PATCH] BLAH ONE
570
571In real life, we will see a discussion that inspired this patch
572discussing related and unrelated things around >8 scissors mark
573in this part of the message.
574
575Subject: [PATCH] BLAH TWO
576
577And 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
582Subject: [PATCH] Teach mailinfo to ignore everything before -- >8 -- mark
583From: Junio C Hamano <gitster@pobox.com>
584
585This teaches mailinfo the scissors -- >8 -- mark; the command ignores
586everything before it in the message body.
587
588Signed-off-by: Junio C Hamano <gitster@pobox.com>
589---
590 builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
591 1 files changed, 36 insertions(+), 1 deletions(-)
592
593diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
594index 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--
6521.6.4.1
653From nobody Mon Sep 17 00:00:00 2001
654From: A U Thor <a.u.thor@example.com>
655Subject: check bogus body header (from)
656Date: Fri, 9 Jun 2006 00:44:16 -0700
657
658From: bogosity
659  - a list
660  - of stuff
661---
662diff --git a/foo b/foo
663index e69de29..d95f3ad 100644
664--- a/foo
665+++ b/foo
666@@ -0,0 +1 @@
667+content
668
669From nobody Mon Sep 17 00:00:00 2001
670From: A U Thor <a.u.thor@example.com>
671Subject: check bogus body header (date)
672Date: Fri, 9 Jun 2006 00:44:16 -0700
673
674Date: bogus
675
676and some content
677
678---
679diff --git a/foo b/foo
680index e69de29..d95f3ad 100644
681--- a/foo
682+++ b/foo
683@@ -0,0 +1 @@
684+content
685
686From nobody Mon Sep 17 00:00:00 2001
687From: A U Thor <a.u.thor@example.com>
688Subject: A E I O U
689Date: Mon, 17 Sep 2012 14:23:44 -0700
690MIME-Version: 1.0
691Content-Type: text/plain; charset="iso-2022-jp"
692Content-type: text/plain; charset="UTF-8"
693
694New content here
695
696diff --git a/foo b/foo
697index e69de29..d95f3ad 100644
698--- a/foo
699+++ b/foo
700@@ -0,0 +1 @@
701+New content
702From nobody Mon Sep 17 00:00:00 2001
703From: A U Thor <a.u.thor@example.com>
704Subject: check multiline inbody headers
705Date: Fri, 9 Jun 2006 00:44:16 -0700
706
707From: Another Thor
708 <a.thor@example.com>
709Subject: This one contains
710	a tab
711 and a space
712
713a commit message
714
715diff --git a/foo b/foo
716index e69de29..d95f3ad 100644
717--- a/foo
718+++ b/foo
719@@ -0,0 +1 @@
720+content
721