vim-patch.sh: improve patching [ci skip] #10154

(fuzz, unified, exit)

Fixes https://github.com/neovim/neovim/issues/10143
This commit is contained in:
Daniel Hahler 2019-06-08 14:42:17 +02:00 committed by Justin M. Keyes
parent 230e75b63f
commit 766657320a

View File

@ -205,7 +205,7 @@ get_vimpatch() {
msg_ok "Found Vim revision '${vim_commit}'." msg_ok "Found Vim revision '${vim_commit}'."
local patch_content local patch_content
patch_content="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}")" patch_content="$(git --no-pager show --unified=5 --color=never -1 --pretty=medium "${vim_commit}")"
cd "${NVIM_SOURCE_DIR}" cd "${NVIM_SOURCE_DIR}"
@ -251,14 +251,14 @@ stage_patch() {
msg_ok "${output}" || msg_ok "${output}" ||
(msg_err "${output}"; false) (msg_err "${output}"; false)
local ret=0
if test -n "$try_apply" ; then if test -n "$try_apply" ; then
if ! check_executable patch; then if ! check_executable patch; then
printf "\n" printf "\n"
msg_err "'patch' command not found\n" msg_err "'patch' command not found\n"
else else
printf "\nApplying patch...\n" printf "\nApplying patch...\n"
patch -p1 < "${patch_file}" || true patch -p1 --fuzz=1 --suffix= < "${patch_file}" || ret=$?
find . -name '*.orig' -type f -delete
fi fi
printf "\nInstructions:\n Proceed to port the patch.\n" printf "\nInstructions:\n Proceed to port the patch.\n"
else else
@ -278,6 +278,7 @@ stage_patch() {
See the wiki for more information: See the wiki for more information:
* https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim * https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim
' "${vim_version}" "${BASENAME}" "${BASENAME}" ' "${vim_version}" "${BASENAME}" "${BASENAME}"
return $ret
} }
hub_pr() { hub_pr() {
@ -563,7 +564,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do
;; ;;
p) p)
stage_patch "${OPTARG}" stage_patch "${OPTARG}"
exit 0 exit
;; ;;
P) P)
stage_patch "${OPTARG}" TRY_APPLY stage_patch "${OPTARG}" TRY_APPLY