diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-08-25 07:44:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-08-25 07:44:49 +0000 |
commit | 111f3874be5925d73c56d3a6da7c8d98f25ad7db (patch) | |
tree | dd9954635fd141e714b0f72bf8cde6897de8236e /Porting/cmpVERSION.pl | |
parent | 364906c750e4f6e22ac4bb4d6b3742a1df87f976 (diff) | |
download | perl-111f3874be5925d73c56d3a6da7c8d98f25ad7db.tar.gz |
cmpVERSION.pl and test.pl now handle checkouts from git-worktree.
Diffstat (limited to 'Porting/cmpVERSION.pl')
-rwxr-xr-x | Porting/cmpVERSION.pl | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl index 4da97e919f..8e083b502b 100755 --- a/Porting/cmpVERSION.pl +++ b/Porting/cmpVERSION.pl @@ -31,8 +31,24 @@ unless (GetOptions('diffs' => \$diffs, die "$0: This does not look like a Perl directory\n" unless -f "perl.h" && -d "Porting"; -die "$0: 'This is a Perl directory but does not look like Git working directory\n" - unless (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR})); + +if (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR})) { + # Looks good +} else { + # Also handle linked worktrees created by git-worktree: + my $found; + if (-f '.git') { + my $commit = '8d063cd8450e59ea1c611a2f4f5a21059a2804f1'; + my $out = `git rev-parse --verify --quiet '$commit^{commit}'`; + chomp $out; + if($out eq $commit) { + ++$found; + } + } + + die "$0: This is a Perl directory but does not look like Git working directory\n" + unless $found; +} my $null = devnull(); |