aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-05-16 23:27:27 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-05-16 23:27:27 -0400
commit39af303600fb1ccd32145b5a95f44a9e4cda6ee9 (patch)
treeedd143ba68d9e6d986c46debd164b52fd0c3a37f
parent68717132b1828c7aeb36a9afb3d046ccb6a4a27a (diff)
parent954f983bc1516ba47d8961538e1ddba09d764794 (diff)
downloadrneovim-39af303600fb1ccd32145b5a95f44a9e4cda6ee9.tar.gz
rneovim-39af303600fb1ccd32145b5a95f44a9e4cda6ee9.tar.bz2
rneovim-39af303600fb1ccd32145b5a95f44a9e4cda6ee9.zip
Merge pull request #4742 from brcolow/shellcheck-lint
Run shellcheck (shell scripting linter) on shell scripts.
-rwxr-xr-xscripts/release.sh6
-rwxr-xr-xscripts/vim-patch.sh59
2 files changed, 40 insertions, 25 deletions
diff --git a/scripts/release.sh b/scripts/release.sh
index 514e5b380a..67738ccc96 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Performs steps to tag a release.
#
@@ -45,11 +45,11 @@ echo "Most recent tag: ${__LAST_TAG}"
echo "Release version: ${__VERSION}"
sed -i -r 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
echo "Building changelog since ${__LAST_TAG}..."
-__CHANGELOG="$(./scripts/git-log-pretty-since.sh $__LAST_TAG 'vim-patch:\S')"
+__CHANGELOG="$(./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:\S')"
git add CMakeLists.txt
git commit --edit -m "${__RELEASE_MSG} ${__CHANGELOG}"
-git tag -a v${__VERSION} -m "NVIM v${__VERSION}"
+git tag -a v"${__VERSION}" -m "NVIM v${__VERSION}"
sed -i -r 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
nvim -c '/NVIM_VERSION' -c 'echo "Update version numbers"' CMakeLists.txt
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 70777535cb..0ddef0f67a 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -47,14 +47,14 @@ clean_files() {
echo
echo "Created files:"
local file
- for file in ${CREATED_FILES[@]}; do
+ for file in "${CREATED_FILES[@]}"; do
echo " • ${file}"
done
read -p "Delete these files (Y/n)? " -n 1 -r reply
echo
if [[ "${reply}" =~ ^[Yy]$ ]]; then
- rm -- ${CREATED_FILES[@]}
+ rm -- "${CREATED_FILES[@]}"
else
echo "You can use 'git clean' to remove these files when you're done."
fi
@@ -97,13 +97,13 @@ assign_commit_details() {
vim_version="${1}"
vim_tag="v${1}"
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
- && git log -1 --format="%H" ${vim_tag})
+ && git log -1 --format="%H" "${vim_tag}")
local strip_commit_line=true
else
# Interpret parameter as commit hash.
vim_version="${1:0:7}"
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
- && git log -1 --format="%H" ${vim_version})
+ && git log -1 --format="%H" "${vim_version}")
local strip_commit_line=false
fi
@@ -132,13 +132,16 @@ get_vim_patch() {
# Patch surgery: preprocess the patch.
# - transform src/ paths to src/nvim/
- local vim_full="$(git show -1 --pretty=medium "${vim_commit}" \
+ local vim_full
+ vim_full="$(git show -1 --pretty=medium "${vim_commit}" \
| LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g')"
local neovim_branch="${BRANCH_PREFIX}${vim_version}"
cd "${NEOVIM_SOURCE_DIR}"
- local git_remote=$(find_git_remote)
- local checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
+ local git_remote
+ git_remote="$(find_git_remote)"
+ local checked_out_branch
+ checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then
echo "✔ Current branch '${checked_out_branch}' seems to be a vim-patch"
@@ -196,20 +199,25 @@ submit_pr() {
check_executable hub
cd "${NEOVIM_SOURCE_DIR}"
- local 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
echo "✘ Current branch '${checked_out_branch}' doesn't seem to be a vim-patch branch."
exit 1
fi
- local git_remote=$(find_git_remote)
- local pr_body="$(git log --reverse --format='#### %s%n%n%b%n' ${git_remote}/master..HEAD)"
- local patches=("$(git log --reverse --format='%s' ${git_remote}/master..HEAD)")
+ local git_remote
+ git_remote="$(find_git_remote)"
+ local pr_body
+ pr_body="$(git log --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)"
+ local patches
+ patches=("$(git log --reverse --format='%s' "${git_remote}"/master..HEAD)")
patches=(${patches[@]//vim-patch:}) # Remove 'vim-patch:' prefix for each item in array.
- local pr_title="${patches[@]}" # Create space-separated string from array.
+ local pr_title="${patches[*]}" # Create space-separated string from array.
pr_title="${pr_title// /,}" # Replace spaces with commas.
- local pr_message="$(printf '[RFC] vim-patch:%s\n\n%s\n' "${pr_title#,}" "${pr_body}")"
+ local pr_message
+ pr_message="$(printf '[RFC] vim-patch:%s\n\n%s\n' "${pr_title#,}" "${pr_body}")"
echo "Pushing to 'origin/${checked_out_branch}'."
output="$(git push origin "${checked_out_branch}" 2>&1)" &&
@@ -225,7 +233,7 @@ submit_pr() {
echo
echo "Cleaning up files."
local patch_file
- for patch_file in ${patches[@]}; do
+ for patch_file in "${patches[@]}"; do
patch_file="vim-${patch_file}.patch"
if [[ ! -f "${NEOVIM_SOURCE_DIR}/${patch_file}" ]]; then
continue
@@ -241,12 +249,14 @@ list_vim_patches() {
printf "\nVim patches missing from Neovim:\n"
# Get commits since 7.4.602.
- local vim_commits=$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v7.4.602..HEAD)
+ local vim_commits
+ vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v7.4.602..HEAD)"
local vim_commit
for vim_commit in ${vim_commits}; do
local is_missing
- local vim_tag=$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)
+ local vim_tag
+ vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)"
if [[ -n "${vim_tag}" ]]; then
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
# Tagged Vim patch, check version.c:
@@ -283,8 +293,10 @@ review_commit() {
local neovim_patch_url="${neovim_commit_url}.patch"
local git_patch_prefix='Subject: \[PATCH\] '
- local neovim_patch="$(curl -Ssf "${neovim_patch_url}")"
- local vim_version="$(head -n 4 <<< "${neovim_patch}" | sed -n "s/${git_patch_prefix}vim-patch:\([a-z0-9.]*\)$/\1/p")"
+ local neovim_patch
+ neovim_patch="$(curl -Ssf "${neovim_patch_url}")"
+ local vim_version
+ vim_version="$(head -n 4 <<< "${neovim_patch}" | sed -n "s/${git_patch_prefix}vim-patch:\([a-z0-9.]*\)$/\1/p")"
echo
if [[ -n "${vim_version}" ]]; then
@@ -300,9 +312,12 @@ review_commit() {
local vim_patch_url="${vim_commit_url}.patch"
- local expected_commit_message="$(commit_message)"
- local message_length="$(wc -l <<< "${expected_commit_message}")"
- local commit_message="$(tail -n +4 <<< "${neovim_patch}" | head -n "${message_length}")"
+ 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 <<< "${neovim_patch}" | head -n "${message_length}")"
if [[ "${commit_message#${git_patch_prefix}}" == "${expected_commit_message}" ]]; then
echo "✔ Found expected commit message."
else
@@ -347,7 +362,7 @@ review_pr() {
local pr_commit_url
local reply
- for pr_commit_url in ${pr_commit_urls[@]}; do
+ for pr_commit_url in "${pr_commit_urls[@]}"; do
review_commit "${pr_commit_url}"
if [[ "${pr_commit_url}" != "${pr_commit_urls[-1]}" ]]; then
read -p "Continue with next commit (Y/n)? " -n 1 -r reply