Changeset 167243 in webkit


Ignore:
Timestamp:
Apr 14, 2014 5:24:23 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Jozsef Berta <jberta.u-szeged@partner.samsung.com> on 2014-04-14
Reviewed by Csaba Osztrogonác.

  • Scripts/commit-log-editor:

(createCommitMessage): Omitting empty Source/JavaScriptCore:... 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.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r167211 r167243  
     12014-04-14  Jozsef Berta  <jberta.u-szeged@partner.samsung.com>
     2
     3        Fix commit-log-editor bug revealed by r165447
     4        https://bugs.webkit.org/show_bug.cgi?id=130676
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        * Scripts/commit-log-editor:
     9        (createCommitMessage): Omitting empty Source/JavaScriptCore:... blocks.
     10        Add \n before the first block too, because the longest common prefix now ends with only one newline.
     11        (removeLongestCommonPrefixEndingInNewline): The longest common prefix ends with only one newline,
     12        now the last block of the common prefix isn't duplicated below. Changing the function name accordingly.
     13
    1142014-04-13  Darin Adler  <darin@apple.com>
    215
  • trunk/Tools/Scripts/commit-log-editor

    r165676 r167243  
    4343sub normalizeLineEndings($$);
    4444sub patchAuthorshipString($$$);
    45 sub removeLongestCommonPrefixEndingInDoubleNewline(\%);
     45sub removeLongestCommonPrefixEndingInNewline(\%);
    4646sub isCommitLogEditor($);
    4747
     
    297297    }
    298298
    299     my $commonPrefix = removeLongestCommonPrefixEndingInDoubleNewline(%changeLogContents);
    300 
    301     my $first = 1;
     299    my $commonPrefix = removeLongestCommonPrefixEndingInNewline(%changeLogContents);
     300
    302301    my @result;
    303302    push @result, normalizeLineEndings($commonPrefix, $endl);
    304303    for my $sortKey (sort keys %changeLogSort) {
    305304        my $label = $changeLogSort{$sortKey};
     305        next if ($changeLogContents{$label} eq "\n");
    306306        if (keys %changeLogSort > 1) {
    307             push @result, normalizeLineEndings("\n", $endl) if !$first;
    308             $first = 0;
     307            push @result, normalizeLineEndings("\n", $endl);
    309308            push @result, normalizeLineEndings("$label: ", $endl);
    310309        }
     
    336335}
    337336
    338 sub removeLongestCommonPrefixEndingInDoubleNewline(\%)
     337sub removeLongestCommonPrefixEndingInNewline(\%)
    339338{
    340339    my ($hashOfStrings) = @_;
     
    356355    return "" unless $prefixLength;
    357356
    358     my $lastDoubleNewline = rindex($prefix, "\n\n");
    359     return "" unless $lastDoubleNewline > 0;
     357    my $lastNewline = rindex($prefix, "\n");
     358    return "" unless $lastNewline > 0;
    360359
    361360    foreach my $key (keys %{$hashOfStrings}) {
    362         $hashOfStrings->{$key} = substr($hashOfStrings->{$key}, $lastDoubleNewline);
    363     }
    364     return substr($prefix, 0, $lastDoubleNewline + 2);
     361        $hashOfStrings->{$key} = substr($hashOfStrings->{$key}, $lastNewline);
     362    }
     363    return substr($prefix, 0, $lastNewline + 1);
    365364}
    366365
Note: See TracChangeset for help on using the changeset viewer.