Thread (7 messages) flat view 7 messages, 4 authors, 2016-06-15
STALE3733d

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

From: Nicolas Sebrecht <hidden>
Date: 2016-06-15 22:47:03

The 16/07/09, Nicolas Sebrecht wrote:
The 16/07/09, Junio C Hamano wrote:
quoted
Stephen Boyd [off-list ref] writes:
quoted
Nicolas Sebrecht wrote:
quoted
quoted
+	# 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.
Thank you.
quoted
Honestly speaking, I do not understand why Nicolas changed my patch at
all.

This patch wastes an extra sed process
Should we really worry about that in a script like git-am.sh? I mean,
does it matter in a day to day work?
Oh I've forgotten, yes we need it: sed -e '/^$/q' leaves this matching
line to the output. An extra CRLF makes 'grep -v' fail.
quoted
                                        introduces [[:blank::]] where
space and tab inside [] is perfectly adequate, and we know the latter is
understood by everybody's sed.
But is harder to read in editors.
quoted
The worst part is that this check was moved before the most common case of
mbox file for which none of the overhead for this this extra processing is
necessary.
Well, I did this move just because of the logical structure of the code.
That said, you're right about the overhead.
-- 
Nicolas Sebrecht
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help