Fixed text file auto-detection: treat EOF character 032 at the end of file as printable
authorDmitry Kakurin <Dmitry.Kakurin@gmail.com>
Fri, 11 Jul 2008 16:48:16 +0000 (18:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 12 Jul 2008 04:14:27 +0000 (21:14 -0700)
Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c

index 352b69d4ceeec411a81469a6146e023aa1d6b338..78efed800d4d64898d438d9590b01be008cfcd36 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
                else
                        stats->printable++;
        }
+
+       /* If file ends with EOF then don't count this EOF as non-printable. */
+       if (size >= 1 && buf[size-1] == '\032')
+               stats->nonprintable--;
 }
 
 /*