am: don't infloop for an empty input file
authorJim Meyering <jim@meyering.net>
Sat, 25 Feb 2012 17:34:26 +0000 (18:34 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2012 00:32:54 +0000 (16:32 -0800)
commitf0c5793b37a53992611968ab4a1d62a0e3edc2dd
tree56d00d3f93f74032aa45899a931dd6f4872bb082
parentad687b447a87efaf61c39075da2ef81b85715186
am: don't infloop for an empty input file

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>
git-am.sh
t/t4150-am.sh