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