[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] parse-diff.c condition for unrecognized lines

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 11 Sep 2015 21:54:37 +0000

Is the following patch correct?

Index: subversion/libsvn_diff/parse-diff.c
===================================================================
--- subversion/libsvn_diff/parse-diff.c (revision 1702341)
+++ subversion/libsvn_diff/parse-diff.c (working copy)
@@ -1438,7 +1438,9 @@ svn_diff_parse_next_patch(svn_patch_t **patch_p,
           /* We have a valid diff header, yay! */
           break;
         }
- else if (state == state_git_tree_seen && line_after_tree_header_read)
+ else if (state == state_git_tree_seen
+ && ! valid_header_line
+ && line_after_tree_header_read)
         {
           /* git patches can contain an index line after the file mode line */
           if (!starts_with(line->data, "index "))

It passes tests.

On the patch-exec branch, I will use this patch to support diffs that
have both mode changes and tree changes: on such diffs, the condition is
evaluated on the "copy to" line (so 'state == state_git_tree_seen'
holds), and the "new mode" line had set 'line_after_tree_header_read' in
a prior iteration (so the condition as a whole holds).

Cheers,

Daniel
Received on 2015-09-11 23:55:33 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.