subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevek...@apache.org
Subject svn commit: r1374802 - /subversion/trunk/subversion/libsvn_diff/parse-diff.c
Date Sun, 19 Aug 2012 17:27:33 GMT
Author: steveking
Date: Sun Aug 19 17:27:33 2012
New Revision: 1374802

URL: http://svn.apache.org/viewvc?rev=1374802&view=rev
Log:
Handle Git patches that contain an index line after the file mode line.

* subversion/libsvn_diff/parse-diff.c
  (svn_diff_parse_next_patch): treat the index patch line as a valid 
  header line that's still part of the current header.

Modified:
    subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=1374802&r1=1374801&r2=1374802&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Sun Aug 19 17:27:33 2012
@@ -1301,19 +1301,24 @@ svn_diff_parse_next_patch(svn_patch_t **
         }
       else if (state == state_git_tree_seen && line_after_tree_header_read)
         {
-          /* We have a valid diff header for a patch with only tree changes.
-           * Rewind to the start of the line just read, so subsequent calls
-           * to this function don't end up skipping the line -- it may
-           * contain a patch. */
-          SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_SET, &last_line,
-                                   scratch_pool));
-          break;
+          /* git patches can contain an index line after the file mode line */
+          if (!starts_with(line->data, "index "))
+          {
+            /* We have a valid diff header for a patch with only tree changes.
+             * Rewind to the start of the line just read, so subsequent calls
+             * to this function don't end up skipping the line -- it may
+             * contain a patch. */
+            SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_SET, &last_line,
+                    scratch_pool));
+            break;
+          }
         }
       else if (state == state_git_tree_seen)
         {
           line_after_tree_header_read = TRUE;
         }
-      else if (! valid_header_line && state != state_start)
+      else if (! valid_header_line && state != state_start
+               && !starts_with(line->data, "index "))
         {
           /* We've encountered an invalid diff header.
            *



Mime
View raw message