Index: dev/subversion/libsvn_diff/parse-diff.c =================================================================== --- dev/subversion/libsvn_diff/parse-diff.c (revision 1720139) +++ dev/subversion/libsvn_diff/parse-diff.c (working copy) @@ -1311,20 +1311,29 @@ parse_next_hunk(svn_diff_hunk_t **hunk, svn_pool_destroy(iterpool); if (! eof) /* Rewind to the start of the line just read, so subsequent calls * to this function or svn_diff_parse_next_patch() don't end * up skipping the line -- it may contain a patch or hunk header. */ SVN_ERR(svn_io_file_seek(apr_file, APR_SET, &last_line, scratch_pool)); if (hunk_seen && start < end) { + /* Did we get the number of context lines announced in the header? + + If not... let's limit the number from the header to what we + actually have */ + if (original_lines) + (*hunk)->original_length -= original_lines; + if (modified_lines) + (*hunk)->modified_length -= modified_lines; + (*hunk)->patch = patch; (*hunk)->apr_file = apr_file; (*hunk)->leading_context = leading_context; (*hunk)->trailing_context = trailing_context; (*hunk)->diff_text_range.start = start; (*hunk)->diff_text_range.current = start; (*hunk)->diff_text_range.end = end; (*hunk)->original_text_range.start = start; (*hunk)->original_text_range.current = start; (*hunk)->original_text_range.end = original_end;