Fourth batch
[gitweb.git] / git-cvsexportcommit.perl
index 9a8188bba785ad68d47ec7b277b016ee76e46f4c..fc00d5946af68e536876d42a1463b21924edefa5 100755 (executable)
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use 5.008;
 use strict;
+use warnings;
 use Getopt::Std;
 use File::Temp qw(tempdir);
 use Data::Dumper;
                chomp($gd);
                $ENV{GIT_DIR} = $gd;
        }
+
+       # On MSYS, convert a Windows-style path to an MSYS-style path
+       # so that rel2abs() below works correctly.
+       if ($^O eq 'msys') {
+               $ENV{GIT_DIR} =~ s#^([[:alpha:]]):/#/$1/#;
+       }
+
        # Make sure GIT_DIR is absolute
        $ENV{GIT_DIR} = File::Spec->rel2abs($ENV{GIT_DIR});
 }
 
 sub usage {
        print STDERR <<END;
-Usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-k] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
+usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-k] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
 END
        exit(1);
 }
@@ -423,6 +431,7 @@ END
 sub safe_pipe_capture {
     my @output;
     if (my $pid = open my $child, '-|') {
+       binmode($child, ":crlf");
        @output = (<$child>);
        close $child or die join(' ',@_).": $! $?";
     } else {