Title: [167243] trunk/Tools
Revision
167243
Author
[email protected]
Date
2014-04-14 05:24:23 -0700 (Mon, 14 Apr 2014)

Log Message

Fix commit-log-editor bug revealed by r165447
https://bugs.webkit.org/show_bug.cgi?id=130676

Patch by Jozsef Berta <[email protected]> on 2014-04-14
Reviewed by Csaba Osztrogonác.

* Scripts/commit-log-editor:
(createCommitMessage): Omitting empty Source/_javascript_Core:... blocks.
Add \n before the first block too, because the longest common prefix now ends with only one newline.
(removeLongestCommonPrefixEndingInNewline): The longest common prefix ends with only one newline,
now the last block of the common prefix isn't duplicated below. Changing the function name accordingly.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (167242 => 167243)


--- trunk/Tools/ChangeLog	2014-04-14 11:40:49 UTC (rev 167242)
+++ trunk/Tools/ChangeLog	2014-04-14 12:24:23 UTC (rev 167243)
@@ -1,3 +1,16 @@
+2014-04-14  Jozsef Berta  <[email protected]>
+
+        Fix commit-log-editor bug revealed by r165447
+        https://bugs.webkit.org/show_bug.cgi?id=130676
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Scripts/commit-log-editor:
+        (createCommitMessage): Omitting empty Source/_javascript_Core:... blocks.
+        Add \n before the first block too, because the longest common prefix now ends with only one newline.
+        (removeLongestCommonPrefixEndingInNewline): The longest common prefix ends with only one newline,
+        now the last block of the common prefix isn't duplicated below. Changing the function name accordingly.
+
 2014-04-13  Darin Adler  <[email protected]>
 
         userVisibleString should not try to "encode" host names

Modified: trunk/Tools/Scripts/commit-log-editor (167242 => 167243)


--- trunk/Tools/Scripts/commit-log-editor	2014-04-14 11:40:49 UTC (rev 167242)
+++ trunk/Tools/Scripts/commit-log-editor	2014-04-14 12:24:23 UTC (rev 167243)
@@ -42,7 +42,7 @@
 sub loadTermReadKey();
 sub normalizeLineEndings($$);
 sub patchAuthorshipString($$$);
-sub removeLongestCommonPrefixEndingInDoubleNewline(\%);
+sub removeLongestCommonPrefixEndingInNewline(\%);
 sub isCommitLogEditor($);
 
 my $endl = "\n";
@@ -296,16 +296,15 @@
         $changeLogContents{$label} = $contents;
     }
 
-    my $commonPrefix = removeLongestCommonPrefixEndingInDoubleNewline(%changeLogContents);
+    my $commonPrefix = removeLongestCommonPrefixEndingInNewline(%changeLogContents);
 
-    my $first = 1;
     my @result;
     push @result, normalizeLineEndings($commonPrefix, $endl);
     for my $sortKey (sort keys %changeLogSort) {
         my $label = $changeLogSort{$sortKey};
+        next if ($changeLogContents{$label} eq "\n");
         if (keys %changeLogSort > 1) {
-            push @result, normalizeLineEndings("\n", $endl) if !$first;
-            $first = 0;
+            push @result, normalizeLineEndings("\n", $endl);
             push @result, normalizeLineEndings("$label: ", $endl);
         }
         push @result, normalizeLineEndings($changeLogContents{$label}, $endl);
@@ -335,7 +334,7 @@
     return "Patch by $authorName <$authorEmail> on $authorDate";
 }
 
-sub removeLongestCommonPrefixEndingInDoubleNewline(\%)
+sub removeLongestCommonPrefixEndingInNewline(\%)
 {
     my ($hashOfStrings) = @_;
 
@@ -355,13 +354,13 @@
 
     return "" unless $prefixLength;
 
-    my $lastDoubleNewline = rindex($prefix, "\n\n");
-    return "" unless $lastDoubleNewline > 0;
+    my $lastNewline = rindex($prefix, "\n");
+    return "" unless $lastNewline > 0;
 
     foreach my $key (keys %{$hashOfStrings}) {
-        $hashOfStrings->{$key} = substr($hashOfStrings->{$key}, $lastDoubleNewline);
+        $hashOfStrings->{$key} = substr($hashOfStrings->{$key}, $lastNewline);
     }
-    return substr($prefix, 0, $lastDoubleNewline + 2);
+    return substr($prefix, 0, $lastNewline + 1);
 }
 
 sub isCommitLogEditor($)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to