Merge remote branch 'shadowcat/master' into sc
[catagits/Gitalist.git] / lib / Gitalist / Git / Repository.pm
index 03239c8..0d0c884 100644 (file)
@@ -11,16 +11,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
     use List::MoreUtils qw/any zip/;
     use DateTime;
     use Encode qw/decode/;
-
-    use if $^O ne 'MSWin32', 'I18N::Langinfo', => qw/langinfo CODESET/;
-    BEGIN {
-        no strict 'subs';
-        *__owner = defined &langinfo
-            ? sub { map { decode(langinfo(CODESET), $_) } (getpwuid $_[0]->path->stat->uid)[6,0] }
-            : sub { return qw/OwnEr GroUp/ }
-        ;
-    }
-
+    use I18N::Langinfo qw/langinfo CODESET/;
     use Gitalist::Git::Object::Blob;
     use Gitalist::Git::Object::Tree;
     use Gitalist::Git::Object::Commit;
@@ -144,10 +135,9 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
             if !$sha1 || $sha1 !~ $SHA1RE;
 
         my @search_opts;
-        if ($search) {
+        if ($search and exists $search->{text}) {
             $search->{type} = 'grep'
                 if $search->{type} eq 'commit';
-           no warnings; # where's this warning coming from?
             @search_opts = (
                 # This seems a little fragile ...
                 qq[--$search->{type}=$search->{text}],
@@ -263,7 +253,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
     }
 
     method _build_owner {
-        my ($gecos, $name) = $self->__owner;
+        my ($gecos, $name) = map { decode(langinfo(CODESET), $_) } (getpwuid $self->path->stat->uid)[6,0];
         $gecos =~ s/,+$//;
         return length($gecos) ? $gecos : $name;
     }