X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fgit-codeowners;a=blobdiff_plain;f=t%2Fapp-codeowners-util.t;h=477d848292ee0e9169033c85c64ee2411dc714b8;hp=4d7d224961c871a3fef55a9c973bc75a3f161a61;hb=8019ec2b1e1938711e4cccf4af19e61512ee8dcd;hpb=c7e14d334a59423ea584fb0206a09bb4a74509a8 diff --git a/t/app-codeowners-util.t b/t/app-codeowners-util.t index 4d7d224..477d848 100644 --- a/t/app-codeowners-util.t +++ b/t/app-codeowners-util.t @@ -42,12 +42,13 @@ subtest 'git_ls_files' => sub { subtest 'git_toplevel' => sub { plan skip_all => 'Cannot run git' if !$can_git; my $repodir =_setup_git_repo(); + my $repodir_fixed = _fix_win32_path($repodir); my $r = App::Codeowners::Util::git_toplevel($repodir); - is($r->canonpath, $repodir->canonpath, 'found toplevel directory from toplevel'); + is($r->canonpath, $repodir_fixed->canonpath, 'found toplevel directory from toplevel'); $r = App::Codeowners::Util::git_toplevel($repodir->child('a/b')); - is($r->canonpath, $repodir->canonpath, 'found toplevel directory'); + is($r->canonpath, $repodir_fixed->canonpath, 'found toplevel directory'); }; subtest 'find_nearest_codeowners' => sub { @@ -99,6 +100,15 @@ sub _setup_git_repo { return $repodir; } +sub _fix_win32_path { + my $path = shift; + # Git for Windows shows full paths + if (eval { require Win32 }) { + $path = path(Win32::GetLongPathName($path)); + } + return $path; +} + sub _spew_codeowners { my $path = path(shift); $path->spew_utf8(\"foo.txt \@twix\n");