diff options
| author | Sven Strickroth <email@cs-ware.de> | 2014-11-13 19:30:47 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2015-01-20 16:17:37 -0600 |
| commit | 0161e096a30912e0721cf3e6446595d3400d55b7 (patch) | |
| tree | de53a009898a7f21d33626d859d3839bee30aadc /src/buf_text.c | |
| parent | 2136240dbd35cf2b4308f92008a24c0c36665811 (diff) | |
| download | libgit2-0161e096a30912e0721cf3e6446595d3400d55b7.tar.gz | |
Make binary detection work similar to vanilla git
Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files)
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'src/buf_text.c')
| -rw-r--r-- | src/buf_text.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buf_text.c b/src/buf_text.c index cead599f4..cb3661edb 100644 --- a/src/buf_text.c +++ b/src/buf_text.c @@ -191,7 +191,10 @@ bool git_buf_text_is_binary(const git_buf *buf) while (scan < end) { unsigned char c = *scan++; - if (c > 0x1F && c < 0x7F) + /* Printable characters are those above SPACE (0x1F) excluding DEL, + * and including BS, ESC and FF. + */ + if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') printable++; else if (c == '\0') return true; |
