]> Dogcows Code - chaz/git-codeowners/commitdiff
compare long paths on win32
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Mon, 18 Nov 2019 00:32:16 +0000 (17:32 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Mon, 18 Nov 2019 00:35:38 +0000 (17:35 -0700)
dist.ini
t/app-codeowners-util.t

index 8a066dec96a8d708fade0f0d4cae7fbb76a162cf..4849184fb0e5666c011a1de80fd7d47682bfecde 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -25,6 +25,7 @@ remove_runtime      = Text::CSV
 remove_runtime      = Text::Table::Any
 remove_runtime      = Unicode::GCString
 remove_runtime      = YAML
+remove_test         = Win32
 [Prereqs / RuntimeRecommends]
 Pod::Usage              = 0
 Term::Detect::Software  = 0
index 4d7d224961c871a3fef55a9c973bc75a3f161a61..477d848292ee0e9169033c85c64ee2411dc714b8 100644 (file)
@@ -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");
This page took 0.020629 seconds and 4 git commands to generate.