summary refs log tree commit diff
path: root/git-cvsexportcommit.perl
diff options
context:
space:
mode:
authorSebastian Schuberth <sschuberth@gmail.com>2012-01-11 10:21:10 +0100
committerJunio C Hamano <gitster@pobox.com>2012-01-11 18:04:08 -0800
commit37495eef4c6071fa124911753cfca3690ea4bf96 (patch)
tree95513a128cf0dac0bb532d7254437b5e49b87ebe /git-cvsexportcommit.perl
parent4397c6535ea314b3412d6a0658ecf44241d07df1 (diff)
git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
Due to MSYS path mangling GIT_DIR contains a Windows-style path when
checked inside a Perl script even if GIT_DIR was previously set to an
MSYS-style path in a shell script. So explicitly convert to an MSYS-style
path before calling Perl's rel2abs() to make it work.

This fix was inspired by a very similar patch in WebKit:

http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsexportcommit.perl')
-rwxr-xr-xgit-cvsexportcommit.perl7
1 files changed, 7 insertions, 0 deletions
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 39a426e067..e6bf25232c 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -30,6 +30,13 @@ if ($opt_w || $opt_W) {
 		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});
 }