t9700: accommodate for MSYS2 Perl reporting as `cygwin`

As of a year or two ago, there is this push to align MSYS2 more closely
with Cygwin, so as to benefit from a closer collaboration. Part of that
is that the triplet `x86_64-pc-cygwin` is used nowadays, whereas it had
been `x86_64-pc-msys` previously. Likewise, Perl now reports `$^O` as
`cygwin` instead of `msys`.

The Perl module test used `msys` as tell-tale when to accommodate for a
native Windows version of `git.exe` which would report absolute
_Windows_ paths rather than those pseudo-Unix paths. We cannot use that
tell-tale anymore, and we also cannot adjust it to `cygwin` because that
would break in Cygwin (where `git.exe` reports absolute pseudo-Unix
paths).

Let's use the environment variable `MSYSTEM` instead (being mindful that
the `MSYSTEM=MSYS` variant would _also_ reflect a setup where `git.exe`
won't report absolute _Windows_ paths).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Johannes Schindelin 2026-09-13 19:11:06 +00:00 committed by Junio C Hamano
parent 47ce80527c
commit 8fff84c417
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ unlink $tmpfile;

# paths
my $abs_git_dir = $abs_repo_dir . "/.git";
if ($^O eq 'msys') {
if (defined $ENV{MSYSTEM} && $ENV{MSYSTEM} ne 'MSYS') {
$abs_git_dir = `cygpath -am "$abs_repo_dir/.git"`;
$abs_git_dir =~ s/\r?\n?$//;
}