X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/42e700c91cf83f56a275ce9688b1f41c5c7a0743..68d2af03d4d9df0563aec7ad1beecd3a21141a5a:/Porting/cmpVERSION.pl diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl old mode 100644 new mode 100755 index 22241c4..dd3d20c --- a/Porting/cmpVERSION.pl +++ b/Porting/cmpVERSION.pl @@ -39,7 +39,9 @@ die "$0: '$source_dir' does not look like a Perl directory\n" die "$0: '$source_dir' is a Perl directory but does not look like Git working directory\n" unless -d catdir($source_dir, ".git"); -my $tag_exists = `git --no-pager tag -l $tag_to_compare 2>/dev/null`; +my $null = $^O eq 'MSWin32' ? 'nul' : '/dev/null'; + +my $tag_exists = `git --no-pager tag -l $tag_to_compare 2>$null`; chomp $tag_exists; die "$0: '$tag_to_compare' is not a known Git tag\n" @@ -78,7 +80,7 @@ my @module_diffs = grep { $this_dir = $1 if m/^(.*)\//; /\.pm$/ && (!defined($this_dir) || ($this_dir !~ $skip_dirs)) && - !exists $skip{$_} && + !exists $skip{$_} && !exists $dual_files{$_} } @all_diffs; @@ -97,10 +99,9 @@ foreach my $pm_file (@module_diffs) { my $pm_version = eval {MM->parse_version($pm_file)}; my $orig_pm_content = get_file_from_git($pm_file, $tag_to_compare); my $orig_pm_version = eval {MM->parse_version(\$orig_pm_content)}; - next unless - defined $pm_version && - defined $orig_pm_version && - $pm_version eq $orig_pm_version; + next if ( ! defined $pm_version || ! defined $orig_pm_version ); + next if ( $pm_version eq 'undef' || $orig_pm_version eq 'undef' ); # sigh + next if $pm_version ne $orig_pm_version; push @output_files, $pm_file; push @output_diffs, $pm_file unless $pm_eq; push @output_diffs, $xs_file unless $xs_eq; @@ -108,7 +109,7 @@ foreach my $pm_file (@module_diffs) { sub compare_git_file { my ($file, $tag) = @_; - open(my $orig_fh, "-|", "git --no-pager show $tag:$file 2>/dev/null"); + open(my $orig_fh, "-|", "git --no-pager show $tag:$file 2>$null"); return undef if eof($orig_fh); my $is_eq = compare($file, $orig_fh) == 0; close($orig_fh); @@ -118,7 +119,7 @@ sub compare_git_file { sub get_file_from_git { my ($file, $tag) = @_; local $/ = undef; - my $file_content = `git --no-pager show $tag:$file 2>/dev/null`; + my $file_content = `git --no-pager show $tag:$file 2>$null`; return $file_content; }