diff options
| author | Denis Laxalde <denis@laxalde.org> | 2019-10-16 22:11:33 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2020-03-26 16:20:18 +0100 |
| commit | fc60777e31495543479bddba62615d9c27476424 (patch) | |
| tree | c0907fbc0d3e93508ccde75652e5486a46d1dfab /src/patch_parse.c | |
| parent | fceedda5dc212d9653992ce623f18b6869944919 (diff) | |
| download | libgit2-fc60777e31495543479bddba62615d9c27476424.tar.gz | |
patch_parse: handle patches without extended headers
Extended header lines (especially the "index <hash>..<hash> <mode>") are
not required by "git apply" so it import patches. So we allow the
from-file/to-file lines (--- a/file\n+++ b/file) to directly follow the
git diff header.
This fixes #5267.
Diffstat (limited to 'src/patch_parse.c')
| -rw-r--r-- | src/patch_parse.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c index 87bc311c5..73f1eb11a 100644 --- a/src/patch_parse.c +++ b/src/patch_parse.c @@ -377,6 +377,7 @@ static const parse_header_transition transitions[] = { { "index " , STATE_DIFF, STATE_INDEX, parse_header_git_index }, { "index " , STATE_END, STATE_INDEX, parse_header_git_index }, + { "--- " , STATE_DIFF, STATE_PATH, parse_header_git_oldpath }, { "--- " , STATE_INDEX, STATE_PATH, parse_header_git_oldpath }, { "+++ " , STATE_PATH, STATE_END, parse_header_git_newpath }, { "GIT binary patch" , STATE_INDEX, STATE_END, NULL }, |
