vim-patch.sh: fix shellcheck issues [ci skip] #10138

This commit is contained in:
Daniel Hahler
2019-06-08 14:02:30 +02:00
committed by Justin M. Keyes
parent faec6fcc6a
commit 25ec0c8805

View File

@@ -30,9 +30,9 @@ usage() {
echo " -g {vim-revision} Download a Vim patch."
echo " -s Create a vim-patch pull request."
echo " -r {pr-number} Review a vim-patch pull request."
echo ' -V Clone the Vim source code to $VIM_SOURCE_DIR.'
echo " -V Clone the Vim source code to \$VIM_SOURCE_DIR."
echo
echo ' $VIM_SOURCE_DIR controls where Vim sources are found'
echo " \$VIM_SOURCE_DIR controls where Vim sources are found"
echo " (default: '${VIM_SOURCE_DIR_DEFAULT}')"
}
@@ -93,9 +93,11 @@ get_vim_sources() {
exit 1
fi
echo "Updating Vim sources: ${VIM_SOURCE_DIR}"
git pull --ff &&
msg_ok "Updated Vim sources." ||
if git pull --ff; then
msg_ok "Updated Vim sources."
else
msg_err "Could not update Vim sources; ignoring error."
fi
fi
}
@@ -147,18 +149,18 @@ preprocess_patch() {
# Remove *.proto, Make*, gui_*, some if_*
local na_src='proto\|Make*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('${na_src}'\)@norm! d/\v(^diff)|%$
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
# Remove unwanted Vim doc files.
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|sponsor\.txt\|intro\.txt\|tags'
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|sponsor\.txt\|intro\.txt\|tags'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('"${na_doc}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
# Remove "Last change ..." changes in doc files.
2>/dev/null $nvim --cmd 'set dir=/tmp' +'%s/^@@.*\n.*For Vim version.*Last change.*\n.*For Vim version.*Last change.*//' +w +q "$file"
# Remove screen dumps, testdir/Make_*.mak files
# Remove screen dumps, testdir/Make_*.mak files
local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms\|dumps/.*.dump'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
@@ -216,6 +218,7 @@ get_vimpatch() {
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
msg_ok "Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'."
@@ -285,6 +288,7 @@ git_hub_pr() {
hub_pr() {
hub pull-request -m "$1"
}
git_hub_pr() {
git hub pull new -m "$1"
@@ -316,7 +320,7 @@ submit_pr() {
fi
local git_remote
git_remote="$(find_git_remote)"
git_remote="$(find_git_remote)"
local pr_body
pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)"
local patches
@@ -369,7 +373,7 @@ list_vimpatch_tokens() {
| sort \
| uniq \
| sed -nE 's/^(vim-patch:([0-9]+\.[^ ]+|[0-9a-z]{7,7})).*/\1/p'
}
}
# Prints all patch-numbers (for the current v:version) for which there is
# a "vim-patch:xxx" token in the Nvim git log.
@@ -410,7 +414,7 @@ show_vimpatches() {
fi
done
}
# Prints a human-formatted list of Vim commits, with instructional messages.
show_vimpatches() {
get_vim_sources
@@ -507,8 +511,9 @@ review_pr() {
require_executable nvim
require_executable jq
get_vim_sources
get_vim_sources
local pr="${1}"
echo
echo "Downloading data for pull request #${pr}."