Index: subversion/libsvn_diff/parse-diff.c =================================================================== --- subversion/libsvn_diff/parse-diff.c (revision 906505) +++ subversion/libsvn_diff/parse-diff.c (arbetskopia) @@ -217,6 +217,7 @@ { static const char * const minus = "--- "; static const char * const atat = "@@"; + svn_stringbuf_t *line; svn_boolean_t eof, in_hunk, hunk_seen; apr_off_t pos, last_line; apr_off_t start, end; @@ -250,7 +251,6 @@ iterpool = svn_pool_create(scratch_pool); do { - svn_stringbuf_t *line; svn_pool_clear(iterpool); @@ -332,7 +332,9 @@ break; } } - while (! eof); + /* We check for the line lenght since a file may not have a newline at the + * end and we depend upon the last line to be an empty one. */ + while (! eof || line->len > 0); svn_pool_destroy(iterpool); if (! eof) Index: subversion/tests/cmdline/patch_tests.py =================================================================== --- subversion/tests/cmdline/patch_tests.py (revision 906505) +++ subversion/tests/cmdline/patch_tests.py (arbetskopia) @@ -1120,7 +1120,7 @@ "+A third new line\n", " \n", " Again, we wish to congratulate you over your email success in our\n" - " computer Balloting.\n" + " computer Balloting. [No trailing newline here]" ] svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))