Changeset 76255 in webkit


Ignore:
Timestamp:
Jan 20, 2011 9:11:18 AM (13 years ago)
Author:
Adam Roben
Message:

Convert paths in environment variables back to msys-style inside commit-log-editor

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 before doing anything else.

Fixes <http://webkit.org/b/48527> commit-log-editor uses full paths for section headers when
using msysgit's Perl and multiple ChangeLogs have been edited

Reviewed by David Kilzer.

  • Scripts/commit-log-editor: Call fixEnvironment before doing anything else.

(fixEnvironment): Added. When run in msys in conjunction with git (i.e., when invoked from
inside git commit), convert Windows-style paths in the environment back to msys-style paths.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r76253 r76255  
     12011-01-19  Adam Roben  <aroben@apple.com>
     2
     3        Convert paths in environment variables back to msys-style inside commit-log-editor
     4
     5        When this script gets run from inside git commit, msys-style paths in the environment will
     6        have been turned into Windows-style paths with forward slashes. This screws up functions
     7        like File::Spec->rel2abs, which seem to rely on $PWD having an msys-style path. We convert
     8        the paths back to msys-style before doing anything else.
     9
     10        Fixes <http://webkit.org/b/48527> commit-log-editor uses full paths for section headers when
     11        using msysgit's Perl and multiple ChangeLogs have been edited
     12
     13        Reviewed by David Kilzer.
     14
     15        * Scripts/commit-log-editor: Call fixEnvironment before doing anything else.
     16        (fixEnvironment): Added. When run in msys in conjunction with git (i.e., when invoked from
     17        inside git commit), convert Windows-style paths in the environment back to msys-style paths.
     18
    1192011-01-20  Zoltan Horvath  <zoltan@webkit.org>
    220
  • trunk/Tools/Scripts/commit-log-editor

    r66059 r76255  
    3939use webkitdirs;
    4040
     41sub fixEnvironment();
    4142sub normalizeLineEndings($$);
    4243sub removeLongestCommonPrefixEndingInDoubleNewline(\%);
     
    5960    usage();
    6061}
     62
     63fixEnvironment();
    6164
    6265my $baseDir = baseProductDir();
     
    283286unlink "$log.edit";
    284287
     288sub fixEnvironment()
     289{
     290    return unless isMsys() && isGit();
     291
     292    # When this script gets run from inside git commit, msys-style paths in the
     293    # environment will have been turned into Windows-style paths with forward
     294    # slashes. This screws up functions like File::Spec->rel2abs, which seem to
     295    # rely on $PWD having an msys-style path. We convert the paths back to
     296    # msys-style here by transforming "c:/foo" to "/c/foo" (e.g.). See
     297    # <http://webkit.org/b/48527>.
     298    foreach my $key (keys %ENV) {
     299        $ENV{$key} =~ s#^([[:alpha:]]):/#/$1/#;
     300    }
     301}
     302
    285303sub normalizeLineEndings($$)
    286304{
Note: See TracChangeset for help on using the changeset viewer.