Tools/Scripts/commit-log-editor is broken due to $_ getting clobbered
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 04:10:30 +0000 (04:10 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 04:10:30 +0000 (04:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77177

Reviewed by Jon Honeycutt.

* Scripts/commit-log-editor:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106082 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/commit-log-editor

index 47d35c9..5fd98b4 100644 (file)
@@ -1,3 +1,12 @@
+2012-01-26  Filip Pizlo  <fpizlo@apple.com>
+
+        Tools/Scripts/commit-log-editor is broken due to $_ getting clobbered
+        https://bugs.webkit.org/show_bug.cgi?id=77177
+
+        Reviewed by Jon Honeycutt.
+
+        * Scripts/commit-log-editor:
+
 2012-01-26  Ojan Vafai  <ojan@chromium.org>
 
         Decrease sleep time when killing server_process on Mac.
index a66139e..466b71c 100755 (executable)
@@ -132,24 +132,24 @@ my @changeLogs = ();
 my $logContents = "";
 my $existingLog = 0;
 open LOG, $log or die "Could not open the log file.";
-while (<LOG>) {
+while (my $curLine = <LOG>) {
     if (isGit()) {
-        if (/^# Changes to be committed:$/) {
+        if ($curLine =~ /^# Changes to be committed:$/) {
             $inChangesToBeCommitted = 1;
-        } elsif ($inChangesToBeCommitted && /^# \S/) {
+        } elsif ($inChangesToBeCommitted && $curLine =~ /^# \S/) {
             $inChangesToBeCommitted = 0;
         }
     }
 
-    if (!isGit() || /^#/) { #
-        $logContents .= $_;
+    if (!isGit() || $curLine =~ /^#/) {
+        $logContents .= $curLine;
     } else {
         # $_ contains the current git log message
         # (without the log comment info). We don't need it.
     }
-    $existingLog = isGit() && !(/^#/ || /^\s*$/) unless $existingLog;
+    $existingLog = isGit() && !($curLine =~ /^#/ || $curLine =~ /^\s*$/) unless $existingLog;
     my $changeLogFileName = changeLogFileName();
-    push @changeLogs, makeFilePathRelative($1) if $inChangesToBeCommitted && (/^(?:M|A)....(.*$changeLogFileName)\r?\n?$/ || /^#\t(?:modified|new file):   (.*$changeLogFileName)$/) && !/-$changeLogFileName$/;
+    push @changeLogs, makeFilePathRelative($1) if $inChangesToBeCommitted && ($curLine =~ /^(?:M|A)....(.*$changeLogFileName)\r?\n?$/ || $curLine =~ /^#\t(?:modified|new file):   (.*$changeLogFileName)$/) && $curLine !~ /-$changeLogFileName$/;
 }
 close LOG;