summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad687b4)
raw | patch | inline | side by side (parent: ad687b4)
author | Jim Meyering <jim@meyering.net> | |
Sat, 25 Feb 2012 17:34:26 +0000 (18:34 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 27 Feb 2012 00:32:54 +0000 (16:32 -0800) |
git-am.sh's check_patch_format function would attempt to preview
the patch to guess its format, but would go into an infinite loop
when the patch file happened to be empty. The solution: exit the
loop when "read" fails, not when the line var, "$l1" becomes empty.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the patch to guess its format, but would go into an infinite loop
when the patch file happened to be empty. The solution: exit the
loop when "read" fails, not when the line var, "$l1" becomes empty.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh | patch | blob | history | |
t/t4150-am.sh | patch | blob | history |
diff --git a/git-am.sh b/git-am.sh
index 1c13b1399185506dd11750fe7e8c1b989a0f3d0c..f43a75b04bf692b9ff6acaae0f6bbe51369aa399 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
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 d7d9ccc1c8c31ef3b2d4763532344d0637a18b5c..03eee07ffb3bcbcac3090eeb3a58e5dcbb66307f 100755 (executable)
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
! 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