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 {
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");