From: Gustavo L. de M. Chaves Date: Wed, 30 Jan 2013 17:22:57 GMT Subject: [PATCH 1/7] perl/Git.pm: test portably if a path is absolute Message-ID: <1359566583-19654-2-git-send-email-gnustavo@cpan.org> In-Reply-To: <1359566583-19654-1-git-send-email-gnustavo@cpan.org> From: "Gustavo L. de M. Chaves" The code was testing if a path was absolute by checking if its first character was a '/'. This does not work on Windows. The portable way to do it is to use File::Spec::file_name_is_absolute. Signed-off-by: Gustavo L. de M. Chaves --- perl/Git.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl/Git.pm b/perl/Git.pm index 931047c..658b602 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -185,7 +185,7 @@ sub repository { }; if ($dir) { - $dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir; + $dir = $opts{Directory} . '/' . $dir unless File::Spec->file_name_is_absolute($dir); $opts{Repository} = abs_path($dir); # If --git-dir went ok, this shouldn't die either. -- 1.7.12.464.g83379df.dirty