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