Skip to content

Commit

Permalink
Fixed text file auto-detection: treat EOF character 032 at the end of…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Dimagog authored and gitster committed Jul 12, 2008
1 parent a9a3e82 commit f9dd4bf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}

/*
Expand Down

0 comments on commit f9dd4bf

Please sign in to comment.