git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Barr <davidbarr@google.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: David Barr <davidbarr@google.com>
Subject: [PATCH] git-am: ignore leading whitespace before patch
Date: Wed,  3 Aug 2011 08:20:46 +1000	[thread overview]
Message-ID: <1312323646-93427-1-git-send-email-davidbarr@google.com> (raw)

Some web-based email clients prepend whitespace to raw message
transcripts to workaround content-sniffing in some browsers.
Adjust the patch format detection logic to ignore leading
whitespace.

Signed-off-by: David Barr <davidbarr@google.com>
---
 git-am.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index 463c741..19b2f0f 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -199,7 +199,11 @@ check_patch_format () {
 	# otherwise, check the first few lines of the first patch to try
 	# to detect its format
 	{
-		read l1
+		# Start from first line containing non-whitespace
+		until [ -n "$l1" ]
+		do
+			read l1
+		done
 		read l2
 		read l3
 		case "$l1" in
-- 
1.7.6

             reply	other threads:[~2011-08-02 22:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 22:20 David Barr [this message]
2011-08-03 12:28 ` [PATCH] git-am: ignore leading whitespace before patch Tay Ray Chuan
2011-08-03 13:21   ` Sverre Rabbelier
2011-08-03 13:31     ` Tay Ray Chuan
2011-08-03 13:33       ` Sverre Rabbelier
2011-08-06  1:56   ` David Barr
2011-08-06  5:00     ` Junio C Hamano
2011-08-08  2:49       ` [PATCH v2] am: " Jonathan Nieder
2011-08-08  5:10 ` David Barr
2011-08-08  5:31   ` David Barr

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=1312323646-93427-1-git-send-email-davidbarr@google.com \
    --to=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).