зеркало из https://github.com/microsoft/git.git
Merge branch 'tk/apply-dev-null-verify-name-fix'
Many places in "git apply" knew that "/dev/null" that signals "there is no such file on this side of the diff" can be followed by whitespace and garbage when parsing a patch, except for one, which made an otherwise valid patch (e.g. ones from subversion) rejected. * tk/apply-dev-null-verify-name-fix: apply: handle Subversion diffs with /dev/null gracefully apply: demonstrate a problem applying svn diffs
This commit is contained in:
Коммит
177bd65cf8
2
apply.c
2
apply.c
|
@ -950,7 +950,7 @@ static int gitdiff_verify_name(struct apply_state *state,
|
|||
}
|
||||
free(another);
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,4 +89,21 @@ test_expect_success 'traditional, whitespace-damaged, colon in timezone' '
|
|||
test_cmp expected "post image.txt"
|
||||
'
|
||||
|
||||
cat >diff-from-svn <<\EOF
|
||||
Index: Makefile
|
||||
===================================================================
|
||||
diff --git a/branches/Makefile
|
||||
deleted file mode 100644
|
||||
--- a/branches/Makefile (revision 13)
|
||||
+++ /dev/null (nonexistent)
|
||||
@@ +1 0,0 @@
|
||||
-
|
||||
EOF
|
||||
|
||||
test_expect_success 'apply handles a diff generated by Subversion' '
|
||||
>Makefile &&
|
||||
git apply -p2 diff-from-svn &&
|
||||
test_path_is_missing Makefile
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче