1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Be slightly less dumb about detecting "binary" files

Summary:
A better definition of "binary" is "not utf-8", instead of "has some characters
not in this arbitrary regexp". Principally, this makes files with windows
newlines not autodetect as binary.

This might fix some of the issues in T365.

Test Plan: @egillth applied this patch and verified that Diffusion now shows
file content instead of detecting everything as binary in his repo full of
Windows newlines.
Reviewed By: jungejason
Reviewers: egillth, tuomaspelkonen, jungejason, aran
CC: aran, jungejason
Differential Revision: 799
This commit is contained in:
epriestley 2011-08-10 11:57:07 -07:00
parent c5198d8bfe
commit 7a72b0b4f9

View file

@ -751,7 +751,7 @@ class ArcanistDiffParser {
$is_binary = false;
if ($this->detectBinaryFiles) {
$is_binary = preg_match('/([^\x09\x0A\x20-\x7E]+)/', $corpus);
$is_binary = !phutil_is_utf8($corpus);
}
if ($is_binary) {