Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-3459

svn patch does not tolerate empty lines of context in unidiff

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • trunk
    • 1.7.0
    • libsvn_diff

    Description

      Whenever a hunk refers to an empty line of context, the line usually
      consists of a single space and a newline, like this:
      
      @@ -a,b +c,d @@
      +foo
      <space><newline>
      -bar
      -baz
      
      However, if for some reason the leading space gets dropped (e.g. when people
      send patches through a mailing list software which eats the extra space away,
      now in case you are wondering what kind of software would do something
      silly like that I will give you a hint: T 1 g r 1 5 dot 0 r g), so that
      the above hunk gets transformed to:
      
      @@ -a,b +c,d @@
      +foo
      <newline>
      -bar
      -baz
      
      ... then 'svn patch' will ignore all lines from the empty line downwards
      as noise and only apply the +foo change in our example hunk.
      That is, everything leading up to but not including the empty line is applied,
      and the rest is ignored.
      
      UNIX patch, however, tolerates this kind of mangling and applies such
      patches just fine. So maybe our own unidiff parser should tolerate it, too.
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            stsp Stefan Sperling
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment