use MooseX::Types::Moose qw/Str Int Bool Maybe ArrayRef/;
use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
- use Fcntl ':mode';
- use constant {
- S_IFINVALID => 0030000,
- S_IFGITLINK => 0160000,
- };
-
- BEGIN {
- no warnings;
- *S_ISLNK = sub ($) {}
- if $^O eq 'MSWin32';
- }
-
# repository and sha1 are required initargs
has repository => ( isa => 'Gitalist::Git::Repository',
required => 1,
}
method _build_modestr {
- # XXX The POSIX constants make win32 sad :(
return _mode_str($self->mode);
}
- # via gitweb.pm
+ # via gitweb.pm circa line 1305
+ use Fcntl ':mode';
+ use constant {
+ S_IFINVALID => 0030000,
+ S_IFGITLINK => 0160000,
+ };
+
# submodule/subrepository, a commit object reference
sub S_ISGITLINK($) {
return (($_[0] & S_IFMT) == S_IFGITLINK)
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;
if ($search) {
$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}],
}
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;
}
my $repo = Gitalist::Git::CollectionOfRepositories::FromDirectory->new( repo_dir => $repo_dir );
isa_ok($repo, 'Gitalist::Git::CollectionOfRepositories::FromDirectory');
-is($repo->repo_dir, Path::Class::Dir->new($repo_dir), "repo->repo_dir is correct" );
+is($repo->repo_dir, $repo_dir, "repo->repo_dir is correct" );
# 'bare.git' is a bare git repository in the repository dir
use Path::Class;
use Data::Dumper;
BEGIN {
- # Don't die on win32.
- eval {
- # Mocking to allow testing regardless of the user's locale
- require I18N::Langinfo;
- no warnings 'redefine';
- *I18N::Langinfo::langinfo = sub($) {
+ # Mocking to allow testing regardless of the user's locale
+ require I18N::Langinfo;
+ no warnings 'redefine';
+ *I18N::Langinfo::langinfo = sub($) {
return "UTF-8" if $_[0] == I18N::Langinfo::CODESET();
- };
- *CORE::GLOBAL::getpwuid = sub {
+ };
+ *CORE::GLOBAL::getpwuid = sub {
wantarray
- ? ("test", "x", "1000", "1000", "", "", "T\x{c3}\x{a9}st", "/home/test", "/bin/bash")
- : "test";
- };
+ ? ("test", "x", "1000", "1000", "", "", "T\x{c3}\x{a9}st", "/home/test", "/bin/bash")
+ : "test";
};
}
isa_ok($tree[0], 'Gitalist::Git::Object', 'tree element 0');
}
-# Be win32 friendly. Poor poor win32.
-if($^O ne 'MSWin32') {
- my $owner = $proj->owner;
- is_flagged_utf8($owner, "Owner name is flagged as utf8");
- is_sane_utf8($owner, "Owner name is not double-encoded");
- is($owner, decode_utf8("T\x{c3}\x{a9}st"), "Owner name is correct");
-}
+my $owner = $proj->owner;
+is_flagged_utf8($owner, "Owner name is flagged as utf8");
+is_sane_utf8($owner, "Owner name is not double-encoded");
+is($owner, decode_utf8("T\x{c3}\x{a9}st"), "Owner name is correct");
);
isa_ok($util, 'Gitalist::Git::Util');
-like( $util->_git, qr#\bgit(?:.CMD)$#, 'git binary found');
+like( $util->_git, qr#/git$#, 'git binary found');
isa_ok($util->gpp, 'Git::PurePerl', 'gpp instance created');
done_testing;