libgit2/tests/diff
Patrick Steinhardt ad5a909cfb patch_parse: fix parsing minimal trailing diff line
In a diff, the shortest possible hunk with a modification (that is, no
deletion) results from a file with only one line with a single character
which is removed. Thus the following hunk

    @@ -1 +1 @@
    -a
    +

is the shortest valid hunk modifying a line. The function parsing the
hunk body though assumes that there must always be at least 4 bytes
present to make up a valid hunk, which is obviously wrong in this case.
The absolute minimum number of bytes required for a modification is
actually 2 bytes, that is the "+" and the following newline. Note: if
there is no trailing newline, the assumption will not be offended as the
diff will have a line "\ No trailing newline" at its end.

This patch fixes the issue by lowering the amount of bytes required.
2017-03-14 13:09:13 +01:00
..
binary.c Fix binary diffs 2015-09-25 10:37:41 -07:00
blob.c test-diff-blob: Pass proper nibble sizes 2015-06-26 16:52:26 +02:00
diff_helpers.c patch: show copy information for identical copies 2016-06-25 23:08:30 -04:00
diff_helpers.h diff::parse tests: test parsing a diff 2016-06-25 23:08:04 -04:00
diffiter.c Drop git_patch_to_str 2014-01-22 17:51:32 +01:00
drivers.c diff: don't error out on an invalid regex 2015-08-15 18:46:38 +02:00
format_email.c Merge branch 'pr/3809' 2016-10-09 16:05:48 +01:00
index.c tests: use legitimate object ids 2016-02-28 18:54:56 -05:00
notify.c Fix some warnings 2015-11-20 20:48:51 +02:00
parse.c patch_parse: fix parsing minimal trailing diff line 2017-03-14 13:09:13 +01:00
patch.c patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
pathspec.c Rename tests-clar to tests 2013-11-14 14:05:52 -08:00
racediffiter.c Added clar test for #3568 2016-03-23 17:17:02 -04:00
rename.c patch: show copy information for identical copies 2016-06-25 23:08:30 -04:00
stats.c Merge branch 'pr/3809' 2016-10-09 16:05:48 +01:00
submodules.c diff: test submodules are found with trailing / 2016-04-02 13:02:41 -07:00
tree.c Add diff progress callback. 2015-11-02 16:33:58 -05:00
workdir.c tests: use legitimate object ids 2016-02-28 18:54:56 -05:00