From 766657320a81eed0007682bb867fe2cfb90c67a6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 8 Jun 2019 14:42:17 +0200 Subject: [PATCH] vim-patch.sh: improve patching [ci skip] #10154 (fuzz, unified, exit) Fixes https://github.com/neovim/neovim/issues/10143 --- scripts/vim-patch.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 6f71f15ddf..6218ba378a 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -205,7 +205,7 @@ get_vimpatch() { msg_ok "Found Vim revision '${vim_commit}'." 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}" @@ -251,14 +251,14 @@ stage_patch() { msg_ok "${output}" || (msg_err "${output}"; false) + local ret=0 if test -n "$try_apply" ; then if ! check_executable patch; then printf "\n" msg_err "'patch' command not found\n" else printf "\nApplying patch...\n" - patch -p1 < "${patch_file}" || true - find . -name '*.orig' -type f -delete + patch -p1 --fuzz=1 --suffix= < "${patch_file}" || ret=$? fi printf "\nInstructions:\n Proceed to port the patch.\n" else @@ -278,6 +278,7 @@ stage_patch() { See the wiki for more information: * https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim ' "${vim_version}" "${BASENAME}" "${BASENAME}" + return $ret } hub_pr() { @@ -563,7 +564,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do ;; p) stage_patch "${OPTARG}" - exit 0 + exit ;; P) stage_patch "${OPTARG}" TRY_APPLY