I committed a patch implementing this, and incorporating your patch below, in r1411723.
I would say it's a portability fix and should be considered for backport -- but I don't feel strongly.
- Julian
Stefan Sperling wrote:
> Currently, lines such as:
> \\ this is a comment
> anywhere in the patch are silently ignored.
>
> If we follow your suggestion we must treat any such lines as hunk
> terminators and assume the hunk lacks a trailing newline.
> I suppose such a change is correct but it's a behaviour change so
> I wouldn't want to backport it to 1.7.x.
>
> Below is a patch. Diff parser tests and patch tests are still passing.
>
> [[[
> * subversion/libsvn_diff/parse-diff.c
> Â (parse_next_hunk): Treat any line that starts with a backslash as a
> Â hunk terminator, indicating that the hunk does not end with EOL.
> Â Comments following the backslash might be localised or missing
> Â in which case parsing the patch would fail.
>
> Suggested by: brane
> ]]]
>
> Index: subversion/libsvn_diff/parse-diff.c
> ===================================================================
> --- subversion/libsvn_diff/parse-diff.c   (revision 1411078)
> +++ subversion/libsvn_diff/parse-diff.c   (working copy)
> @@ -555,15 +555,11 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
> Â Â Â pos = 0;
> Â Â Â SVN_ERR(svn_io_file_seek(apr_file, APR_CUR, &pos, iterpool));
>
> -Â Â Â /* Lines starting with a backslash are comments, such as
> +Â Â Â /* Lines starting with a backslash indicate a missing EOL:
> Â Â Â Â * "\ No newline at end of file". */
> Â Â Â if (line->data[0] == '\\')
> Â Â Â Â {
> -Â Â Â Â Â if (in_hunk &&
> -Â Â Â Â Â Â Â ((!*is_property &&
> -Â Â Â Â Â Â Â Â strcmp(line->data, "\\ No newline at end of
> file") == 0) ||
> -Â Â Â Â Â Â Â (*is_property &&
> -Â Â Â Â Â Â Â Â strcmp(line->data, "\\ No newline at end of
> property") == 0)))
> +Â Â Â Â Â if (in_hunk)
> Â Â Â Â Â Â {
> Â Â Â Â Â Â Â char eolbuf[2];
> Â Â Â Â Â Â Â apr_size_t len;
>
Received on 2012-11-20 17:20:19 CET