From af12fb7b3048c5bdd2e90885a6736ebc29d84f01 Mon Sep 17 00:00:00 2001
From: Nicolas Sebrecht <ni.s@laposte.net>
Date: Thu, 6 Aug 2009 20:08:13 -0500
Subject: [PATCH] git-am: print fair error message when format detection fails

Avoid git ending with this message:
	"Patch format  is not supported."

With improved error message in the format detection failure case by
Giuseppe Bilotta.

Signed-off-by: Nicolas Sebrecht <ni.s@laposte.net>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-am.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/git-am.sh b/git-am.sh
index dd60f5d9cb..f719f6e654 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -268,7 +268,11 @@ split_patches () {
 		msgnum=
 		;;
 	*)
-		clean_abort "Patch format $patch_format is not supported."
+		if test -n "$parse_patch" ; then
+			clean_abort "Patch format $patch_format is not supported."
+		else
+			clean_abort "Patch format detection failed."
+		fi
 		;;
 	esac
 }
-- 
2.40.0