Changeset 94554 in webkit


Ignore:
Timestamp:
Sep 6, 2011 12:26:13 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

PrettyPatch should handle "delta" patch mechanism in git binary patches
https://bugs.webkit.org/show_bug.cgi?id=67628

Git patches are encoded using two mechanisms - "literal" and "delta".
See this email from the git mailing list archive for info
http://marc.info/?l=git&m=114682417113315&w=2

When determining if a binary file patch is an image or not we should accept
both literal and delta patch encodings.

Patch by Ben Wells <benwells@chromium.org> on 2011-09-06
Reviewed by Shinichiro Hamaji.

  • PrettyPatch/PrettyPatch.rb:
  • PrettyPatch/PrettyPatch_test.rb:
Location:
trunk/Websites/bugs.webkit.org
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/bugs.webkit.org/ChangeLog

    r90132 r94554  
     12011-09-06  Ben Wells  <benwells@chromium.org>
     2
     3        PrettyPatch should handle "delta" patch mechanism in git binary patches
     4        https://bugs.webkit.org/show_bug.cgi?id=67628
     5
     6        Git patches are encoded using two mechanisms - "literal" and "delta".
     7        See this email from the git mailing list archive for info
     8        http://marc.info/?l=git&m=114682417113315&w=2
     9
     10        When determining if a binary file patch is an image or not we should accept
     11        both literal and delta patch encodings.
     12
     13        Reviewed by Shinichiro Hamaji.
     14
     15        * PrettyPatch/PrettyPatch.rb:
     16        * PrettyPatch/PrettyPatch_test.rb:
     17
    1182011-06-30  Adam Barth  <abarth@webkit.org>
    219
  • trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb

    r90132 r94554  
    1414    def self.prettify(string)
    1515        $last_prettify_file_count = -1
    16         $last_prettify_part_count = { "remove" => 0, "add" => 0, "shared" => 0 }
     16        $last_prettify_part_count = { "remove" => 0, "add" => 0, "shared" => 0, "binary" => 0 }
    1717        string = normalize_line_ending(string)
    1818        fileDiffs = FileDiff.parse(string)
     
    6666    GIT_BINARY_FILE_MARKER_FORMAT = /^GIT binary patch$/
    6767
    68     GIT_LITERAL_FORMAT = /^literal \d+$/
     68    GIT_BINARY_PATCH_FORMAT = /^(literal|delta) \d+$/
    6969
    7070    START_OF_BINARY_DATA_FORMAT = /^[0-9a-zA-Z\+\/=]{20,}/ # Assume 20 chars without a space is base64 binary data.
     
    509509                when GIT_BINARY_FILE_MARKER_FORMAT
    510510                    @binary = true
    511                     if (GIT_LITERAL_FORMAT.match(lines[i + 1]) and PrettyPatch.has_image_suffix(@filename)) then
     511                    if (GIT_BINARY_PATCH_FORMAT.match(lines[i + 1]) and PrettyPatch.has_image_suffix(@filename)) then
    512512                        @git_image = true
    513513                        startOfSections = i + 1
     
    586586                end
    587587            elsif @binary then
     588                $last_prettify_part_count["binary"] += 1
    588589                str += "<span class='text'>Binary file, nothing to see here</span>"
    589590            else
  • trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch_test.rb

    r85657 r94554  
    2727        83127 => ["Only add stuff", 2, 2, 0, 3],
    2828        85071 => ["Adds and removes from a file plus git signature", 2, 5, 3, 9],
     29        104633 => ["Delta mechanism for binary patch in git diff", 12, 3, 5, 3],
    2930    }
    3031
     
    5859        assert_equal(info[Info::REMOVE], $last_prettify_part_count["remove"], "Wrong number of 'remove' parts in " + description)
    5960        assert_equal(info[Info::SHARED], $last_prettify_part_count["shared"], "Wrong number of 'shared' parts in " + description)
     61        assert_equal(0, $last_prettify_part_count["binary"], "Wrong number of 'binary' parts in " + description)
    6062    end
    6163
Note: See TracChangeset for help on using the changeset viewer.