aboutsummaryrefslogtreecommitdiff
path: root/scripts/vim-patch.sh
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-06-08 14:42:17 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-06-08 14:42:17 +0200
commit766657320a81eed0007682bb867fe2cfb90c67a6 (patch)
tree1ec1d4946bf756c851e225f9f7629886dc5063f0 /scripts/vim-patch.sh
parent230e75b63f165179a16d6e936fffe7bf3ebb1fdc (diff)
downloadrneovim-766657320a81eed0007682bb867fe2cfb90c67a6.tar.gz
rneovim-766657320a81eed0007682bb867fe2cfb90c67a6.tar.bz2
rneovim-766657320a81eed0007682bb867fe2cfb90c67a6.zip
vim-patch.sh: improve patching [ci skip] #10154
(fuzz, unified, exit) Fixes https://github.com/neovim/neovim/issues/10143
Diffstat (limited to 'scripts/vim-patch.sh')
-rwxr-xr-xscripts/vim-patch.sh9
1 files 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