Subject: [PATCH] Teach mailinfo %< as an alternative scissors mark

From: Jonathan Nieder <[email-masked]>
Date: Sat, 3 Apr 2010 14:52:17 -0500

Handle perforations found “in the wild” more robustly by recognizing
“%<” as an alternative scissors mark.

This feature is only meant to support old habits.  Discourage new use
of the percent-based version by only documenting the 8< symbol so new
users’ perforations can still be recognized by old versions of Git.

Signed-off-by: Jonathan Nieder <[email-masked]>
---
Junio C Hamano wrote:

> Thanks, will queue.  By the way, please spell scissors as 8< or >8 not
> with a per-cent at least for now.

Thanks for pointing it out.  I will from now on.

Searching for “cut here” on groups.google.com revealed several examples
like this one:

 ______________________%<__cut here ______________>%_____________

[ed: dashes converted to underscores to avoid confusing am]

So I guess I’m the only one using the small-fingered scissors.  Maybe
this patch could help support old habits.

 builtin/mailinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index ce2ef6b..4a9729b 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -746,7 +746,8 @@ static int is_scissors_line(const struct strbuf *line)
 			continue;
 		}
 		if (i + 1 < len &&
-		    (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2))) {
+		    (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2) ||
+		     !memcmp(buf + i, ">%", 2) || !memcmp(buf + i, "%<", 2))) {
 			in_perforation = 1;
 			perforation += 2;
 			scissors += 2;
-- 
1.7.0.3