Skip to content

Commit f9dd4bf

Browse files
Dimagoggitster
authored andcommitted
Fixed text file auto-detection: treat EOF character 032 at the end of file as printable
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>
1 parent a9a3e82 commit f9dd4bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

convert.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
6161
else
6262
stats->printable++;
6363
}
64+
65+
/* If file ends with EOF then don't count this EOF as non-printable. */
66+
if (size >= 1 && buf[size-1] == '\032')
67+
stats->nonprintable--;
6468
}
6569

6670
/*

0 commit comments

Comments
 (0)