Merge pull request #16895 from dundargoc/ci/fix-shellcheck-warnings

ci: fix shellcheck errors introduced in version 0.8.0
This commit is contained in:
James McCoy
2022-01-03 11:40:20 -05:00
committed by GitHub

View File

@@ -266,8 +266,6 @@ get_vimpatch() {
cd "${NVIM_SOURCE_DIR}"
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"
@@ -282,23 +280,32 @@ stage_patch() {
local nvim_remote
nvim_remote="$(find_git_remote)"
local checked_out_branch
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
local checked_out_branch
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"
echo " branch; not creating a new branch."
else
printf '\nFetching "%s/master".\n' "${nvim_remote}"
if output="$(git fetch "$nvim_remote" master 2>&1)"; then
msg_ok "$output"
else
output="$(git fetch "${nvim_remote}" master 2>&1)" &&
msg_ok "${output}" ||
(msg_err "${output}"; false)
msg_err "$output"
exit 1
fi
local nvim_branch="${BRANCH_PREFIX}${vim_version}"
echo
echo "Creating new branch '${nvim_branch}' based on '${nvim_remote}/master'."
cd "${NVIM_SOURCE_DIR}"
if output="$(git checkout -b "$nvim_branch" "$nvim_remote/master" 2>&1)"; then
echo "Creating new branch '${nvim_branch}' based on '${nvim_remote}/master'."
cd "${NVIM_SOURCE_DIR}"
output="$(git checkout -b "${nvim_branch}" "${nvim_remote}/master" 2>&1)" &&
msg_ok "$output"
else
msg_err "$output"
exit 1
fi
fi
printf "\nCreating empty commit with correct commit message.\n"
if output="$(commit_message | git commit --allow-empty --file 2>&1 -)"; then
@@ -340,8 +347,6 @@ git_hub_pr() {
gh_pr() {
gh pr create --title "$1" --body "$2"
}
}
git_hub_pr() {
@@ -392,17 +397,23 @@ submit_pr() {
push_remote="$(git config --get branch."${checked_out_branch}".pushRemote || true)"
if [[ -z "$push_remote" ]]; then
push_remote="$(git config --get remote.pushDefault || true)"
if [[ -z "$push_remote" ]]; then
push_remote="$(git config --get branch."${checked_out_branch}".remote || true)"
if [[ -z "$push_remote" ]] || [[ "$push_remote" == "$nvim_remote" ]]; then
if [[ -z "$push_remote" ]]; then
push_remote="$(git config --get branch."${checked_out_branch}".remote || true)"
if [[ -z "$push_remote" ]] || [[ "$push_remote" == "$nvim_remote" ]]; then
push_remote="$(find_git_remote fork)"
fi
fi
fi
echo "Pushing to '${push_remote}/${checked_out_branch}'."
if output="$(git push "$push_remote" "$checked_out_branch" 2>&1)"; then
msg_ok "$output"
else
output="$(git push "${push_remote}" "${checked_out_branch}" 2>&1)" &&
msg_ok "${output}" ||
(msg_err "${output}"; false)
msg_err "$output"
exit 1
fi
echo
fi
echo "Creating pull request."
if output="$($submit_fn "$pr_title" "$pr_body" 2>&1)"; then
@@ -565,13 +576,13 @@ show_vimpatches() {
# Prints a human-formatted list of Vim commits, with instructional messages.
# Passes "$@" onto list_missing_vimpatches (args for git-log).
show_vimpatches() {
get_vim_sources update
get_vim_sources update
printf "Vim patches missing from Neovim:\n"
local -A runtime_commits
for commit in $(git -C "${VIM_SOURCE_DIR}" log --format="%H %D" -- runtime | sed 's/,\? tag: / /g'); do
runtime_commits[$commit]=1
done
done
while read -r vim_commit; do
if [[ "${runtime_commits[$vim_commit]-}" ]]; then
@@ -692,14 +703,14 @@ review_commit() {
CREATED_FILES+=("${NVIM_SOURCE_DIR}/n${patch_file}")
local nvim="nvim -u NONE -n -i NONE --headless"
2>/dev/null $nvim --cmd 'set dir=/tmp' +'1,/^$/g/^ /-1join' +w +q "${NVIM_SOURCE_DIR}/n${patch_file}"
2>/dev/null $nvim --cmd 'set dir=/tmp' +'1,/^$/g/^ /-1join' +w +q "${NVIM_SOURCE_DIR}/n${patch_file}"
local expected_commit_message
expected_commit_message="$(commit_message)"
local message_length
message_length="$(wc -l <<< "${expected_commit_message}")"
local commit_message
commit_message="$(tail -n +4 "${NVIM_SOURCE_DIR}/n${patch_file}" | head -n "${message_length}")"
commit_message="$(tail -n +4 "${NVIM_SOURCE_DIR}/n${patch_file}" | head -n "${message_length}")"
if [[ "${commit_message#"$git_patch_prefix"}" == "${expected_commit_message}" ]]; then
msg_ok "Found expected commit message."
else