projects
/
catagits/Gitalist.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
Fixed Gitalist::Utils::is_binary to work.
[catagits/Gitalist.git]
/
lib
/
Gitalist
/
Utils.pm
diff --git
a/lib/Gitalist/Utils.pm
b/lib/Gitalist/Utils.pm
index
c40d825
..
f11dc34
100644
(file)
--- a/
lib/Gitalist/Utils.pm
+++ b/
lib/Gitalist/Utils.pm
@@
-46,9
+46,8
@@
sub age_string {
}
sub is_binary {
- my($str) = @_;
- open my $fh, '<', \$str or return;
- return -B $fh;
+ # Crappy heuristic - does the first line or so look printable?
+ return $_[0] !~ /^[[:print:]]+$ (?: \s ^[[:print:]]+$ )?/mx;
}
1;