summaryrefslogtreecommitdiffstats
path: root/Tools/Scripts/commit-log-editor
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/commit-log-editor')
-rwxr-xr-xTools/Scripts/commit-log-editor18
1 files changed, 18 insertions, 0 deletions
diff --git a/Tools/Scripts/commit-log-editor b/Tools/Scripts/commit-log-editor
index f40295d..2dda7e2 100755
--- a/Tools/Scripts/commit-log-editor
+++ b/Tools/Scripts/commit-log-editor
@@ -38,6 +38,7 @@ use Term::ReadKey;
use VCSUtils;
use webkitdirs;
+sub fixEnvironment();
sub normalizeLineEndings($$);
sub removeLongestCommonPrefixEndingInDoubleNewline(\%);
sub isCommitLogEditor($);
@@ -59,6 +60,8 @@ if (!$log) {
usage();
}
+fixEnvironment();
+
my $baseDir = baseProductDir();
my $editor = $ENV{SVN_LOG_EDITOR};
@@ -282,6 +285,21 @@ if ($foundComment) {
unlink "$log.edit";
+sub fixEnvironment()
+{
+ return unless isMsys() && isGit();
+
+ # When this script gets run from inside git commit, msys-style paths in the
+ # environment will have been turned into Windows-style paths with forward
+ # slashes. This screws up functions like File::Spec->rel2abs, which seem to
+ # rely on $PWD having an msys-style path. We convert the paths back to
+ # msys-style here by transforming "c:/foo" to "/c/foo" (e.g.). See
+ # <http://webkit.org/b/48527>.
+ foreach my $key (keys %ENV) {
+ $ENV{$key} =~ s#^([[:alpha:]]):/#/$1/#;
+ }
+}
+
sub normalizeLineEndings($$)
{
my ($string, $endl) = @_;