summaryrefslogtreecommitdiff
path: root/tests/patch/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5159 from pks-t/pks/patch-parse-old-missing-nlEdward Thomson2019-07-201-3/+23
|\ | | | | patch_parse: handle missing newline indicator in old file
| * patch_parse: ensure valid patch output with EOFNLErik Aigner2019-07-111-9/+15
| |
| * patch_parse: handle missing newline indicator in old filePatrick Steinhardt2019-07-111-0/+14
| | | | | | | | | | | | | | | | | | | | | | When either the old or new file contents have no newline at the end of the file, then git-diff(1) will print out a "\ No newline at end of file" indicator. While we do correctly handle this in the case where the new file has this indcator, we fail to parse patches where the old file is missing a newline at EOF. Fix this bug by handling and missing newline indicators in the old file. Add tests to verify that we can parse such files.
* | patch_parse: do not depend on parsed buffer's lifetimePatrick Steinhardt2019-07-051-0/+20
|/ | | | | | | | | | | When parsing a patch from a buffer, we let the patch lines point into the original buffer. While this is efficient use of resources, this also ties the lifetime of the parsed patch to the parsed buffer. As this behaviour is not documented anywhere in our API it is very surprising to its users. Untie the lifetime by duplicating the lines into the parsed patch. Add a test that verifies that lifetimes are indeed independent of each other.
* patch_parse: allow parsing ambiguous patch headersPatrick Steinhardt2017-11-111-0/+6
| | | | | | | | | | | | | | | The git patch format allows for having unquoted paths with whitespaces inside. This format becomes ambiguous to parse, e.g. in the following example: diff --git a/file b/with spaces.txt b/file b/with spaces.txt While we cannot parse this in a correct way, we can instead use the "---" and "+++" lines to retrieve the file names, as the path is not followed by anything here but spans the complete remaining line. Because of this, we can simply bail outwhen parsing the "diff --git" header here without an actual error and then proceed to just take the paths from the other headers.
* patch: differentiate not found and invalid patchesEdward Thomson2016-05-261-6/+75
|
* git_patch_parse_ctx: refcount the contextEdward Thomson2016-05-261-0/+1
|
* patch: `git_patch_from_patchfile` -> `git_patch_from_buffer`Edward Thomson2016-05-261-1/+2
|
* Introduce git_patch_options, handle prefixesEdward Thomson2016-05-261-3/+5
| | | | | Handle prefixes (in terms of number of path components) for patch parsing.
* patch_parse: ensure we can parse a patchEdward Thomson2016-05-261-0/+31