Skip to content

Commit 38a347e

Browse files
author
Edward Thomson
committed
patch::parse: handle patches with no hunks
Patches may have no hunks when there's no modifications (for example, in a rename). Handle them.
1 parent e774d5a commit 38a347e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/patch_parse.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ typedef struct {
361361
} header_git_op;
362362

363363
static const header_git_op header_git_ops[] = {
364+
{ "diff --git ", NULL },
364365
{ "@@ -", NULL },
365366
{ "GIT binary patch", NULL },
366367
{ "--- ", parse_header_git_oldpath },
@@ -437,7 +438,8 @@ static int parse_header_git(
437438
}
438439

439440
if (!found) {
440-
error = parse_err("invalid patch header at line %d", ctx->line_num);
441+
error = parse_err("invalid patch header at line %d",
442+
ctx->line_num);
441443
goto done;
442444
}
443445
}

0 commit comments

Comments
 (0)