apply: handle Subversion diffs with /dev/null gracefully
Subversion generates diffs that can contain lines like this one: --- /dev/null (nonexistent) Let's teach Git's apply machinery to handle such a line gracefully. This fixes https://github.com/git-for-windows/git/isues/1489 Signed-off-by: Tatyana Krasnukha <tatyana@synopsys.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f16ef7bd4c
commit
e454ad4bec
2
apply.c
2
apply.c
@ -975,7 +975,7 @@ static int gitdiff_verify_name(struct apply_state *state,
|
|||||||
}
|
}
|
||||||
free(another);
|
free(another);
|
||||||
} else {
|
} else {
|
||||||
if (!starts_with(line, "/dev/null\n"))
|
if (!is_dev_null(line))
|
||||||
return error(_("git apply: bad git-diff - expected /dev/null on line %d"), state->linenr);
|
return error(_("git apply: bad git-diff - expected /dev/null on line %d"), state->linenr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ deleted file mode 100644
|
|||||||
-
|
-
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_failure 'apply handles a diff generated by Subversion' '
|
test_expect_success 'apply handles a diff generated by Subversion' '
|
||||||
>Makefile &&
|
>Makefile &&
|
||||||
git apply -p2 diff-from-svn &&
|
git apply -p2 diff-from-svn &&
|
||||||
test_path_is_missing Makefile
|
test_path_is_missing Makefile
|
||||||
|
Loading…
Reference in New Issue
Block a user