Merge pull request #8593 from jamessan/vim-patch-printf-fix

vim-patch: Replace shell variables in printf with formatted args
This commit is contained in:
James McCoy
2018-06-19 11:05:28 -04:00
committed by GitHub

View File

@@ -37,11 +37,11 @@ usage() {
}
msg_ok() {
printf "\e[32m✔\e[0m $@\n"
printf '\e[32m✔\e[0m %s\n' "$@"
}
msg_err() {
printf "\e[31m✘\e[0m $@\n"
printf '\e[31m✘\e[0m %s\n' "$@"
}
# Checks if a program is in the user's PATH, and is executable.
@@ -218,7 +218,7 @@ stage_patch() {
local git_remote
git_remote="$(find_git_remote)"
local checked_out_branch
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then
msg_ok "Current branch '${checked_out_branch}' seems to be a vim-patch"
@@ -248,21 +248,22 @@ stage_patch() {
printf "\n"
msg_err "'patch' command not found\n"
else
printf "\nApplying patch...\n"
printf "\nApplying patch...\n"
patch -p1 < "${patch_file}" || true
find -name '*.orig' -type f -delete
fi
printf "\nInstructions:\n Proceed to port the patch.\n"
fi
printf "\nInstructions:\n Proceed to port the patch.\n"
else
printf "\nInstructions:\n Proceed to port the patch.\n Try the 'patch' command (or use '${BASENAME} -P ...' next time):\n patch -p1 < ${patch_file}\n"
fi
printf '\nInstructions:\n Proceed to port the patch.\n Try the "patch" command (or use "%s -P ..." next time):\n patch -p1 < %s\n' "${BASENAME}" "${patch_file}"
fi
printf '
Stage your changes ("git add ..."), then use "git commit --amend" to commit.
To port more patches (if any) related to %s,
run "%s" again.
* Do this only for _related_ patches (otherwise it increases the
* Do this only for _related_ patches (otherwise it increases the
size of the pull request, making it harder to review)
When you are done, try "%s -s" to create the pull request.
@@ -398,24 +399,24 @@ show_vimpatches() {
}
# Prints a human-formatted list of Vim commits, with instructional messages.
show_vimpatches() {
show_vimpatches() {
get_vim_sources
printf "\nVim patches missing from Neovim:\n"
printf "\nVim patches missing from Neovim:\n"
list_missing_vimpatches | while read vim_commit; do
if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then
printf "${vim_commit} (+runtime)\n"
else
printf "${vim_commit}\n"
fi
done
echo
echo "Instructions:"
echo
echo " To port one of the above patches to Neovim, execute"
echo " this script with the patch revision as argument and"
echo " follow the instructions."
printf ' • %s (+runtime)\n' "${vim_commit}"
else
printf ' • %s\n' "${vim_commit}"
fi
done
printf "Instructions:
To port one of the above patches to Neovim, execute
this script with the patch revision as argument and
follow the instructions.
Examples: '%s -p 7.4.487'
'%s -p 1e8ebf870720e7b671f98f22d653009826304c4f'
@@ -436,7 +437,7 @@ review_commit() {
echo
if [[ -n "${vim_version}" ]]; then
msg_ok "Detected Vim patch '${vim_version}'."
msg_ok "Detected Vim patch '${vim_version}'."
else
msg_err "Could not detect the Vim patch number."
echo " This script assumes that the PR contains only commits"