Commit 38a347ea by Edward Thomson

patch::parse: handle patches with no hunks

Patches may have no hunks when there's no modifications (for example,
in a rename).  Handle them.
parent e774d5af
...@@ -361,6 +361,7 @@ typedef struct { ...@@ -361,6 +361,7 @@ typedef struct {
} header_git_op; } header_git_op;
static const header_git_op header_git_ops[] = { static const header_git_op header_git_ops[] = {
{ "diff --git ", NULL },
{ "@@ -", NULL }, { "@@ -", NULL },
{ "GIT binary patch", NULL }, { "GIT binary patch", NULL },
{ "--- ", parse_header_git_oldpath }, { "--- ", parse_header_git_oldpath },
...@@ -437,7 +438,8 @@ static int parse_header_git( ...@@ -437,7 +438,8 @@ static int parse_header_git(
} }
if (!found) { if (!found) {
error = parse_err("invalid patch header at line %d", ctx->line_num); error = parse_err("invalid patch header at line %d",
ctx->line_num);
goto done; goto done;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment