From: Steffen Prohaska Date: Fri, 11 Jul 2008 16:48:16 GMT Subject: [PATCH] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable Message-ID: <1215794896-31354-1-git-send-email-prohaska@zib.de> In-Reply-To: <7vabh0d4t9.fsf@gitster.siamese.dyndns.org> From: Dmitry Kakurin Signed-off-by: Dmitry Kakurin Signed-off-by: Steffen Prohaska --- convert.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/convert.c b/convert.c index 352b69d..78efed8 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--; } /* -- 1.5.6.1.282.gd8a0d