summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-am.sh2
-rwxr-xr-xt/t4150-am.sh10
2 files changed, 11 insertions, 1 deletions
diff --git a/git-am.sh b/git-am.sh
index 1c13b13991..f43a75b04b 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -201,7 +201,7 @@ check_patch_format () {
l1=
while test -z "$l1"
do
- read l1
+ read l1 || break
done
read l2
read l3
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index d7d9ccc1c8..03eee07ffb 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -495,4 +495,14 @@ test_expect_success 'am -q is quiet' '
! test -s output.out
'
+test_expect_success 'am empty-file does not infloop' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ touch empty-file &&
+ test_tick &&
+ { git am empty-file > actual 2>&1 && false || :; } &&
+ echo Patch format detection failed. >expected &&
+ test_cmp expected actual
+'
+
test_done