Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [PATCH v5] git-am: allow e-mail file(s) as input

From: Stephen Boyd <hidden>
Date: 2016-06-15 22:47:03

Possibly related (same subject, not in this thread)

Nicolas Sebrecht wrote:
quoted hunk ↗ jump to hunk
diff --git a/git-am.sh b/git-am.sh
index d64d997..2b55ddc 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -162,6 +162,17 @@ check_patch_format () {
 		return 0
 	fi
 
+	# Then, accept what really looks like (series of) email(s).
+	# the first sed select headers but the folded ones
+	sed -e '/^$/q' -e '/^[[:blank:]]/d' "$1" |
+	# this one is necessary for the next 'grep -v'
+	sed -e '/^$/d' |
+	grep -v -E -e '^[A-Za-z]+(-[A-Za-z]+)*:' ||
+	{
+		patch_format=mbox
+		return 0
+	}
+
 	# otherwise, check the first few lines of the first patch to try
 	# to detect its format
 	{
This fails t4150-am.sh #10 (am -3 -q is quiet). You should redirect the
output of the sed and grep to /dev/null like Junio did in his "how about
this" patch.

Also, writing some tests would be helpful.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help