public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Stephen Boyd <bebarino@gmail•com>
Cc: Johannes Sixt <j6t@kdbg•org>, GIT <git@vger•kernel.org>,
	Chris Packham <judge.packham@gmail•com>
Subject: Re: [RFC PATCHv3 1/4] am: avoid re-directing stdin twice
Date: Fri, 05 Sep 2014 15:25:06 -0700	[thread overview]
Message-ID: <xmqqfvg5puws.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqk35hpvbg.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Fri, 05 Sep 2014 15:16:19 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> Redoing what e3f67d30 (am: fix patch format detection for
> Thunderbird "Save As" emails, 2010-01-25) tried to do without
> wasting a fork and a pipe may be a workable improvement.
>
> I see Stephen who wrote the original "Thunderbird save-as" is
> already on the Cc list.  How about doing it this way instead?

Not that way, but more like this.

 git-am.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index ee61a77..32e3039 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -250,8 +250,7 @@ check_patch_format () {
 			# discarding the indented remainder of folded lines,
 			# and see if it looks like that they all begin with the
 			# header field names...
-			tr -d '\015' <"$1" |
-			sed -n -e '/^$/q' -e '/^[ 	]/d' -e p |
+			sed -n -e 's/\r$//' -e '/^$/q' -e '/^[ 	]/d' -e p |
 			sane_egrep -v '^[!-9;-~]+:' >/dev/null ||
 			patch_format=mbox
 		fi

  reply	other threads:[~2014-09-05 22:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:06 [RFC PATCHv3 0/4] am: patch-format Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 1/4] am: avoid re-directing stdin twice Chris Packham
2014-09-05 20:26   ` Johannes Sixt
2014-09-05 21:31     ` Chris Packham
2014-09-05 22:00       ` Junio C Hamano
2014-09-05 22:16         ` Junio C Hamano
2014-09-05 22:25           ` Junio C Hamano [this message]
2014-09-05 23:18             ` Stephen Boyd
2014-09-06  7:34               ` Junio C Hamano
2014-09-06 12:46                 ` Torsten Bögershausen
2014-09-05 10:06 ` [RFC PATCHv3 2/4] t/am: add test for stgit patch format Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 3/4] t/am: add tests for hg " Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 4/4] am: add gitk " Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqfvg5puws.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=bebarino@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=judge.packham@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox