From f9dd4bf4e58af0b4828c7e7013080dba59f8a6b9 Mon Sep 17 00:00:00 2001 From: Dmitry Kakurin Date: Fri, 11 Jul 2008 18:48:16 +0200 Subject: Fixed text file auto-detection: treat EOF character 032 at the end of file as printable Signed-off-by: Dmitry Kakurin Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- convert.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'convert.c') diff --git a/convert.c b/convert.c index 352b69d4ce..78efed800d 100644 --- 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--; } /* -- cgit v1.2.3