aboutsummaryrefslogtreecommitdiff
path: root/scripts/vim-patch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vim-patch.sh')
-rwxr-xr-xscripts/vim-patch.sh33
1 files changed, 13 insertions, 20 deletions
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 4a567727d8..1f6c787b24 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -38,11 +38,10 @@ check_executable() {
get_vim_sources() {
check_executable git
- echo "Retrieving Vim sources."
+ cd "${VIM_SOURCE_DIR}"
if [[ ! -d ${VIM_SOURCE_DIR} ]]; then
echo "Cloning Vim sources into '${VIM_SOURCE_DIR}'."
git clone --depth=1000 https://github.com/vim/vim.git "${VIM_SOURCE_DIR}"
- cd "${VIM_SOURCE_DIR}"
else
if [[ ! -d "${VIM_SOURCE_DIR}/.git" ]]; then
echo "✘ ${VIM_SOURCE_DIR} does not appear to be a git repository."
@@ -50,7 +49,6 @@ get_vim_sources() {
exit 1
fi
echo "Updating Vim sources in '${VIM_SOURCE_DIR}'."
- cd "${VIM_SOURCE_DIR}"
git pull &&
echo "✔ Updated Vim sources." ||
echo "✘ Could not update Vim sources; ignoring error."
@@ -58,11 +56,8 @@ get_vim_sources() {
}
commit_message() {
- echo "vim-patch:${vim_version}
-
-${vim_message}
-
-${vim_commit_url}"
+ printf 'vim-patch:%s\n\n%s\n\n%s' "${vim_version}" \
+ "${vim_message}" "${vim_commit_url}"
}
assign_commit_details() {
@@ -102,8 +97,10 @@ get_vim_patch() {
# Collect patch details and store into variables.
vim_full="$(git show -1 --pretty=medium "${vim_commit}")"
+ # Patch surgery: preprocess the patch.
+ # - transform src/ paths to src/nvim/
vim_diff="$(git show -1 "${vim_commit}" \
- | sed -e 's/\( [ab]\/src\)/\1\/nvim/g')" # Change directory to src/nvim.
+ | LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g')"
neovim_message="$(commit_message)"
neovim_pr="
\`\`\`
@@ -161,22 +158,20 @@ ${vim_diff}
list_vim_patches() {
get_vim_sources
- echo
- echo "Vim patches missing from Neovim:"
+ printf "\nVim patches missing from Neovim:\n"
# Get tags since 7.4.442.
- local vim_tags=$(cd "${VIM_SOURCE_DIR}" && \
- git tag --contains v7.4.442)
+ local vim_tags=$(cd "${VIM_SOURCE_DIR}" && git tag --contains v7.4.442)
# Get non-versioned commits since e2719096.
if git log -1 --grep='.' --invert-grep > /dev/null 2>&1 ; then
local vim_runtime_commits=$(cd "${VIM_SOURCE_DIR}" && \
- git log --format='%H' --grep='^patch' --grep='^updated for version' --invert-grep e2719096250a19ecdd9a35d13702879f163d2a50..HEAD)
- else
- # --invert-grep requires git 2.4+
+ git log --reverse --format='%H' --grep='^patch' --grep='^updated for version' \
+ --invert-grep e2719096250a19ecdd9a35d13702879f163d2a50..HEAD)
+ else # --invert-grep requires git 2.4+
echo "Warning: some runtime updates may not be listed (requires git 2.4+)."
local vim_runtime_commits=$(cd "${VIM_SOURCE_DIR}" && \
- git log --format='%H' --grep='Updated' e2719096250a19ecdd9a35d13702879f163d2a50..HEAD)
+ git log --reverse --format='%H' --grep='Updated' e2719096250a19ecdd9a35d13702879f163d2a50..HEAD)
fi
local vim_commit
@@ -191,7 +186,7 @@ list_vim_patches() {
else
# Untagged Vim patch (e.g. runtime updates), check the Neovim git log:
is_missing="$(cd "${NEOVIM_SOURCE_DIR}" &&
- git log -1 --no-merges --grep="vim\-patch:${vim_commit:0:7}" --pretty=format:"false")"
+ git log -1 --no-merges --grep="vim\-patch:${vim_commit:0:7}" --pretty=format:false)"
fi
if [[ ${is_missing} != "false" ]]; then
@@ -258,8 +253,6 @@ review_pr() {
echo "✔ Saved full pull request commit details to '${NEOVIM_SOURCE_DIR}/n${base_name}.patch'."
git show "${vim_commit}" > "${NEOVIM_SOURCE_DIR}/${base_name}.diff"
echo "✔ Saved Vim diff to '${NEOVIM_SOURCE_DIR}/${base_name}.diff'."
- git show "${vim_commit}" > "${NEOVIM_SOURCE_DIR}/${base_name}.patch"
- echo "✔ Saved full Vim commit details to '${NEOVIM_SOURCE_DIR}/${base_name}.patch'."
echo "You can use 'git clean' to remove these files when you're done."
echo