Git.pm: stop assuming that absolute paths start with a slash

On Windows, absolute paths never start with a slash, unless a POSIX emulation layer is used. The latter is the case for MSYS2's Perl that Git for Windows leverages. However, in the tests we also go through plain `git.exe`, which does *not* leverage the POSIX emulation layer, and therefore the paths we pass to Perl may actually be DOS-style paths such as C:/Program Files/Git. So let's just use Perl's own way to test whether a given path is absolute or not instead of home-brewing our own. This patch partially fixes t7800 and t9700 when running in Git for Windows' SDK. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 26, 2016 at 15:34 UTC 888ab716adff5babae718e4e4cb83b3c3a5f1bc5
1 file changed +2 -1
perl/Git.pm
+2 -1
@@ -188,7 +188,8 @@ sub repository {
188 };
189
190 if ($dir) {
191 - $dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
191 + _verify_require();
192 + File::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir;
193 $opts{Repository} = abs_path($dir);
194
195 # If --git-dir went ok, this shouldn't die either.