From 5cf6beb22178a844bc1b6e75e744eb04508b865c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 13 Oct 2019 23:09:09 +0200 Subject: scripts/vim-patch.sh -l: display commit subjects Closes https://github.com/neovim/neovim/pull/11182. --- scripts/vim-patch.sh | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 2cc32f0dd0..4efe509008 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -366,7 +366,7 @@ submit_pr() { # Gets all Vim commits since the "start" commit. list_vim_commits() { ( - cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD "$@" + cd "${VIM_SOURCE_DIR}" && git log --reverse v8.0.0000..HEAD "$@" ) } # Prints all (sorted) "vim-patch:xxx" tokens found in the Nvim git log. @@ -389,6 +389,7 @@ list_vimpatch_numbers() { } # Prints a newline-delimited list of Vim commits, for use by scripts. +# "$1": use extended format? # "$@" is passed to list_vim_commits, as extra arguments to git-log. list_missing_vimpatches() { local token vim_commit vim_tag patch_number @@ -396,6 +397,13 @@ list_missing_vimpatches() { declare -A vim_commit_tags declare -a git_log_args + local extended_format=$1; shift + if [[ "$extended_format" == 1 ]]; then + git_log_args=("--format=%H %s") + else + git_log_args=("--format=%H") + fi + # Massage arguments for git-log. declare -A git_log_replacements=( [^\(.*/\)?src/nvim/\(.*\)]="\${BASH_REMATCH[1]}src/\${BASH_REMATCH[2]}" @@ -431,13 +439,27 @@ list_missing_vimpatches() { # Get missing Vim commits set +u # Avoid "unbound variable" with bash < 4.4 below. - for vim_commit in $(list_vim_commits "${git_log_args[@]}"); do + local vim_commit info + while IFS=' ' read -r line; do # Check for vim-patch: (usually runtime updates). - token="vim-patch:${vim_commit:0:7}" + token="vim-patch:${line:0:7}" if [[ "${tokens[$token]-}" ]]; then continue fi + # Get commit hash, and optional info from line. This is used in + # extended mode, and when using e.g. '--format' manually. + vim_commit=${line%% *} + if [[ "$vim_commit" == "$line" ]]; then + info= + else + info=${line#* } + if [[ -n $info ]]; then + # Remove any "patch 8.0.0902: " prefixes, and prefix with ": ". + info=": ${info#patch*: }" + fi + fi + vim_tag="${vim_commit_tags[$vim_commit]-}" if [[ -n "$vim_tag" ]]; then # Check for vim-patch: (not commit hash). @@ -445,11 +467,11 @@ list_missing_vimpatches() { if [[ "${tokens[$patch_number]-}" ]]; then continue fi - echo "$vim_tag" + printf '%s%s\n' "$vim_tag" "$info" else - echo "$vim_commit" + printf '%s%s\n' "$vim_commit" "$info" fi - done + done < <(list_vim_commits "${git_log_args[@]}") set -u } @@ -464,7 +486,7 @@ show_vimpatches() { runtime_commits[$commit]=1 done - list_missing_vimpatches "$@" | while read -r vim_commit; do + list_missing_vimpatches 1 "$@" | while read -r vim_commit; do if [[ "${runtime_commits[$vim_commit]-}" ]]; then printf ' • %s (+runtime)\n' "${vim_commit}" else @@ -596,7 +618,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do ;; L) shift # remove opt - list_missing_vimpatches "$@" + list_missing_vimpatches 0 "$@" exit 0 ;; M) -- cgit From c5c06665ed302e774dc1a01bed949815b4b7c8c3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 16 Oct 2019 15:44:38 +0200 Subject: scripts/vim-patch.sh: lazily update Vim source (#11207) This gets done only initially, for `-l`, and when a commit cannot be found. Also provide more compact instructions with `-l` / `show_vimpatches`. --- scripts/vim-patch.sh | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 4efe509008..2a04805606 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -89,7 +89,7 @@ get_vim_sources() { echo "Cloning Vim into: ${VIM_SOURCE_DIR}" git clone https://github.com/vim/vim.git "${VIM_SOURCE_DIR}" cd "${VIM_SOURCE_DIR}" - else + elif [[ "${1-}" == update ]]; then cd "${VIM_SOURCE_DIR}" if ! [ -d ".git" ] \ && ! [ "$(git rev-parse --show-toplevel)" = "${VIM_SOURCE_DIR}" ]; then @@ -103,6 +103,8 @@ get_vim_sources() { else msg_err "Could not update Vim sources; ignoring error." fi + else + cd "${VIM_SOURCE_DIR}" fi } @@ -124,7 +126,7 @@ find_git_remote() { } # Assign variables for a given Vim tag, patch version, or commit. -# Might exit in case it cannot be found. +# Might exit in case it cannot be found, after updating Vim sources. assign_commit_details() { local vim_commit_ref if [[ ${1} =~ v?[0-9]\.[0-9]\.[0-9]{3,4} ]]; then @@ -146,9 +148,14 @@ assign_commit_details() { local munge_commit_line=false fi - vim_commit=$(git -C "${VIM_SOURCE_DIR}" log -1 --format="%H" "${vim_commit_ref}" --) || { - >&2 msg_err "Couldn't find Vim revision '${vim_commit_ref}'." - exit 3 + local get_vim_commit_cmd="git -C ${VIM_SOURCE_DIR} log -1 --format=%H ${vim_commit_ref} --" + vim_commit=$($get_vim_commit_cmd 2>&1) || { + # Update Vim sources. + get_vim_sources update + vim_commit=$($get_vim_commit_cmd 2>&1) || { + >&2 msg_err "Couldn't find Vim revision '${vim_commit_ref}': git error: ${vim_commit}." + exit 3 + } } vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}" @@ -478,8 +485,8 @@ list_missing_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 - printf "\nVim patches missing from Neovim:\n" + 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 @@ -494,17 +501,12 @@ show_vimpatches() { fi done - printf "Instructions: - - To port one of the above patches to Neovim, execute - this script with the patch revision as argument and - follow the instructions. - - Examples: '%s -p 7.4.487' - '%s -p 1e8ebf870720e7b671f98f22d653009826304c4f' + printf "\nInstructions: + To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g. + '%s -p v8.0.1234', or '%s -P v8.0.1234' NOTE: Please port the _oldest_ patch if you possibly can. - Out-of-order patches increase the possibility of bugs. + You can use '%s -l path/to/file' to see what patches are missing for a file. " "${BASENAME}" "${BASENAME}" } @@ -646,7 +648,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do exit 0 ;; V) - get_vim_sources + get_vim_sources update exit 0 ;; *) -- cgit From 2ba212e8c25794184ce465d468eb62714ea7ba03 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 8 Nov 2019 15:17:55 +0100 Subject: vim-patch.sh: add missing argument [skip ci] --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 2a04805606..b946266599 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -507,7 +507,7 @@ show_vimpatches() { NOTE: Please port the _oldest_ patch if you possibly can. You can use '%s -l path/to/file' to see what patches are missing for a file. -" "${BASENAME}" "${BASENAME}" +" "${BASENAME}" "${BASENAME}" "${BASENAME}" } review_commit() { -- cgit From 9fb278ddea492cdae53be6fd948c75498df2f712 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 8 Nov 2019 20:47:58 +0100 Subject: vim-patch.sh: multiline printf -> heredoc (#11351) The following script is cut out from vim-patch.sh: ```sh #!/usr/bin/env bash BASENAME=vim-patch.sh printf "\nInstructions: To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g. '%s -p v8.0.1234', or '%s -P v8.0.1234' NOTE: Please port the _oldest_ patch if you possibly can. You can use '%s -l path/to/file' to see what patches are missing for a file. " "${BASENAME}" "${BASENAME}" "${BASENAME}" ``` The code itself should be correct, but shellcheck 0.7.0 says: ``` In /tmp/test.sh line 5: printf "\nInstructions: ^-- SC2183: This format string has 2 variables, but is passed 3 arguments. ``` We also had a problem before that a `%s` was added, but the accompanying argument to printf was forgotten. Using a heredoc is less error-prone, since we insert variables directly. --- scripts/vim-patch.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b946266599..b6a0df4649 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -501,13 +501,15 @@ show_vimpatches() { fi done - printf "\nInstructions: + cat << EOF + +Instructions: To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g. - '%s -p v8.0.1234', or '%s -P v8.0.1234' + '${BASENAME} -p v8.0.1234', or '${BASENAME} -P v8.0.1234' NOTE: Please port the _oldest_ patch if you possibly can. - You can use '%s -l path/to/file' to see what patches are missing for a file. -" "${BASENAME}" "${BASENAME}" "${BASENAME}" + You can use '${BASENAME} -l path/to/file' to see what patches are missing for a file. +EOF } review_commit() { -- cgit From 34abe8fd23e7760fff4824c08dd8ee7eb4f7dd67 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 24 Dec 2019 08:15:18 +0100 Subject: vim-patch.sh: list related missing Vim patches [ci skip] #11514 * scripts/vim-patch.sh: factor out _set_tokens_and_tags This allows for caching `$tokens` and `$vim_commit_tags`, which will become relevant with the next commit adding `list_missing_previous_vimpatches_for_patch`. --- scripts/vim-patch.sh | 122 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 22 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b6a0df4649..483264415e 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -395,13 +395,48 @@ list_vimpatch_numbers() { done } +declare -A tokens +declare -A vim_commit_tags + +_set_tokens_and_tags() { + if [[ -n "${tokens[*]}" ]]; then + return + fi + + # Find all "vim-patch:xxx" tokens in the Nvim git log. + for token in $(list_vimpatch_tokens); do + tokens[$token]=1 + done + + # Create an associative array mapping Vim commits to tags. + eval "vim_commit_tags=( + $(git -C "${VIM_SOURCE_DIR}" for-each-ref refs/tags \ + --format '[%(objectname)]=%(refname:strip=2)' \ + --sort='-*authordate' \ + --shell) + )" + # Exit in case of errors from the above eval (empty vim_commit_tags). + if ! (( "${#vim_commit_tags[@]}" )); then + msg_err "Could not get Vim commits/tags." + exit 1 + fi +} + # Prints a newline-delimited list of Vim commits, for use by scripts. # "$1": use extended format? # "$@" is passed to list_vim_commits, as extra arguments to git-log. list_missing_vimpatches() { + local -a missing_vim_patches=() + _set_missing_vimpatches "$@" + for line in "${missing_vim_patches[@]}"; do + printf '%s\n' "$line" + done +} + +# Sets / appends to missing_vim_patches (useful to avoid a subshell when +# used multiple times to cache tokens/vim_commit_tags). +_set_missing_vimpatches() { local token vim_commit vim_tag patch_number - declare -A tokens - declare -A vim_commit_tags declare -a git_log_args local extended_format=$1; shift @@ -416,6 +451,7 @@ list_missing_vimpatches() { [^\(.*/\)?src/nvim/\(.*\)]="\${BASH_REMATCH[1]}src/\${BASH_REMATCH[2]}" [^\(.*/\)?\.vim-src/\(.*\)]="\${BASH_REMATCH[2]}" ) + local i j for i in "$@"; do for j in "${!git_log_replacements[@]}"; do if [[ "$i" =~ $j ]]; then @@ -426,23 +462,7 @@ list_missing_vimpatches() { git_log_args+=("$i") done - # Find all "vim-patch:xxx" tokens in the Nvim git log. - for token in $(list_vimpatch_tokens); do - tokens[$token]=1 - done - - # Create an associative array mapping Vim commits to tags. - eval "declare -A vim_commit_tags=( - $(git -C "${VIM_SOURCE_DIR}" for-each-ref refs/tags \ - --format '[%(objectname)]=%(refname:strip=2)' \ - --sort='-*authordate' \ - --shell) - )" - # Exit in case of errors from the above eval (empty vim_commit_tags). - if ! (( "${#vim_commit_tags[@]}" )); then - msg_err "Could not get Vim commits/tags." - exit 1 - fi + _set_tokens_and_tags # Get missing Vim commits set +u # Avoid "unbound variable" with bash < 4.4 below. @@ -474,9 +494,9 @@ list_missing_vimpatches() { if [[ "${tokens[$patch_number]-}" ]]; then continue fi - printf '%s%s\n' "$vim_tag" "$info" + missing_vim_patches+=("$vim_tag$info") else - printf '%s%s\n' "$vim_commit" "$info" + missing_vim_patches+=("$vim_commit$info") fi done < <(list_vim_commits "${git_log_args[@]}") set -u @@ -512,6 +532,59 @@ Instructions: EOF } +list_missing_previous_vimpatches_for_patch() { + local for_vim_patch="${1}" + local vim_commit vim_tag + assign_commit_details "${for_vim_patch}" + + local file + local -a missing_list + local -a fnames + while IFS= read -r line ; do + fnames+=("$line") + done < <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "${vim_commit}") + local i=0 + local n=${#fnames[@]} + printf '=== getting missing patches for %d files ===\n' "$n" + if [[ -z "${vim_tag}" ]]; then + printf 'NOTE: "%s" is not a Vim tag - listing all oldest missing patches\n' "${for_vim_patch}" >&2 + fi + for fname in "${fnames[@]}"; do + i=$(( i+1 )) + printf '[%.*d/%d] %s: ' "${#n}" "$i" "$n" "$fname" + + local -a missing_vim_patches=() + _set_missing_vimpatches 1 -- "${fname}" + + local missing_vim_commit_info="${missing_vim_patches[0]}" + if [[ -z "${missing_vim_commit_info}" ]]; then + printf -- "-\n" + else + local missing_vim_commit="${missing_vim_commit_info%%:*}" + if [[ -z "${vim_tag}" ]] || [[ "${missing_vim_commit}" < "${vim_tag}" ]]; then + printf -- "%s\n" "$missing_vim_commit_info" + missing_list+=("$missing_vim_commit_info") + else + printf -- "-\n" + fi + fi + done + + if [[ -z "${missing_list[*]}" ]]; then + msg_ok 'no missing previous Vim patches' + return 0 + fi + + local -a missing_unique + while IFS= read -r line; do + missing_unique+=("$line") + done < <(printf '%s\n' "${missing_list[@]}" | sort -u) + + msg_err "$(printf '%d missing previous Vim patches:' ${#missing_unique[@]})" + printf ' - %s\n' "${missing_unique[@]}" + return 1 +} + review_commit() { local nvim_commit_url="${1}" local nvim_patch_url="${nvim_commit_url}.patch" @@ -609,7 +682,7 @@ review_pr() { clean_files } -while getopts "hlLMVp:P:g:r:s" opt; do +while getopts "hlLmMVp:P:g:r:s" opt; do case ${opt} in h) usage @@ -629,6 +702,11 @@ while getopts "hlLMVp:P:g:r:s" opt; do list_vimpatch_numbers exit 0 ;; + m) + shift # remove opt + list_missing_previous_vimpatches_for_patch "$@" + exit 0 + ;; p) stage_patch "${OPTARG}" exit -- cgit From 5f1aec5abdb551e5f3035ca054d36580b3233efb Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 25 Dec 2019 13:02:23 +0100 Subject: Fix scripts/vim-patch.sh for Bash 4.3 Ref: https://github.com/neovim/neovim/pull/11514#issuecomment-568780231 --- scripts/vim-patch.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 483264415e..b5806311c9 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -399,9 +399,11 @@ declare -A tokens declare -A vim_commit_tags _set_tokens_and_tags() { + set +u # Avoid "unbound variable" with bash < 4.4 below. if [[ -n "${tokens[*]}" ]]; then return fi + set -u # Find all "vim-patch:xxx" tokens in the Nvim git log. for token in $(list_vimpatch_tokens); do -- cgit From 81a0d10f131ddea0bd5faa50e362deb97c0abb08 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 28 Dec 2019 00:11:38 -0500 Subject: fixup! vim-patch.sh: list related missing Vim patches [ci skip] #11514 --- scripts/vim-patch.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b5806311c9..769f0fed58 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -430,9 +430,11 @@ _set_tokens_and_tags() { list_missing_vimpatches() { local -a missing_vim_patches=() _set_missing_vimpatches "$@" + set +u # Avoid "unbound variable" with bash < 4.4 below. for line in "${missing_vim_patches[@]}"; do printf '%s\n' "$line" done + set -u } # Sets / appends to missing_vim_patches (useful to avoid a subshell when -- cgit From a4d21f05928b3534cf9df11b0ccc3f86d79d88bc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 11 Jan 2020 15:09:54 -0500 Subject: vim-patch.sh: fix for bash 4.3 or older #11700 --- scripts/vim-patch.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 769f0fed58..d76c8573c9 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -574,10 +574,12 @@ list_missing_previous_vimpatches_for_patch() { fi done + set +u # Avoid "unbound variable" with bash < 4.4 below. if [[ -z "${missing_list[*]}" ]]; then msg_ok 'no missing previous Vim patches' return 0 fi + set -u local -a missing_unique while IFS= read -r line; do -- cgit From 4c152be72665808a45f1e957e3fde53eaf9bdc25 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 19 Jan 2020 10:05:23 -0500 Subject: fixup! fixup! vim-patch.sh: list related missing Vim patches [ci skip] #11514 --- scripts/vim-patch.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index d76c8573c9..ff78cb82f7 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -560,6 +560,7 @@ list_missing_previous_vimpatches_for_patch() { local -a missing_vim_patches=() _set_missing_vimpatches 1 -- "${fname}" + set +u # Avoid "unbound variable" with bash < 4.4 below. local missing_vim_commit_info="${missing_vim_patches[0]}" if [[ -z "${missing_vim_commit_info}" ]]; then printf -- "-\n" @@ -572,6 +573,7 @@ list_missing_previous_vimpatches_for_patch() { printf -- "-\n" fi fi + set -u done set +u # Avoid "unbound variable" with bash < 4.4 below. -- cgit From c6ff23d7a0d5ccf0d8995e3204c18df55d28fc7f Mon Sep 17 00:00:00 2001 From: Chris LaRose Date: Sun, 26 Jan 2020 00:24:42 -0800 Subject: terminal: absolute CWD in term:// URI #11289 This makes it possible to restore the working directory of :terminal buffers when reading those buffers from a session file. Fixes #11288 Co-authored-by: Justin M. Keyes --- scripts/vim-patch.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index ff78cb82f7..f9726e8a87 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -234,7 +234,8 @@ get_vimpatch() { msg_ok "Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'." } -# shellcheck disable=SC2015 # "Note that A && B || C is not if-then-else." +# shellcheck disable=SC2015 +# ^ "Note that A && B || C is not if-then-else." stage_patch() { get_vimpatch "$1" local try_apply="${2:-}" @@ -305,7 +306,8 @@ git_hub_pr() { git hub pull new -m "$1" } -# shellcheck disable=SC2015 # "Note that A && B || C is not if-then-else." +# shellcheck disable=SC2015 +# ^ "Note that A && B || C is not if-then-else." submit_pr() { require_executable git local push_first -- cgit From f755370682ad6e82f468975b40cf734e5b5f47c9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 26 Jan 2020 14:50:25 +0100 Subject: scripts/vim-patch.sh: add -m to usage Ref: https://github.com/neovim/neovim/pull/11514#issuecomment-569476828 --- scripts/vim-patch.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index f9726e8a87..6c9bea2ad3 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -23,6 +23,7 @@ usage() { echo " -h Show this message and exit." echo " -l [git-log opts] List missing Vim patches." echo " -L [git-log opts] List missing Vim patches (for scripts)." + echo " -m {vim-revision} List previous (older) missing Vim patches." echo " -M List all merged patch-numbers (at current v:version)." echo " -p {vim-revision} Download and generate a Vim patch. vim-revision" echo " can be a Vim version (8.0.xxx) or a Git hash." -- cgit From 20f5f448830db553ae9b3bc4cfc1602d66b0aa3e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 26 Jan 2020 15:07:41 +0100 Subject: set -u before return Follow up to a4d21f059. --- scripts/vim-patch.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 6c9bea2ad3..7eeb644318 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -582,6 +582,7 @@ list_missing_previous_vimpatches_for_patch() { set +u # Avoid "unbound variable" with bash < 4.4 below. if [[ -z "${missing_list[*]}" ]]; then msg_ok 'no missing previous Vim patches' + set -u return 0 fi set -u -- cgit From 1dc5e5ae9b3c5aa057e21df5fd9978b47ed3492e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 26 Jan 2020 15:20:51 +0100 Subject: doc --- scripts/vim-patch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 7eeb644318..ecaddeacf6 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -428,7 +428,7 @@ _set_tokens_and_tags() { } # Prints a newline-delimited list of Vim commits, for use by scripts. -# "$1": use extended format? +# "$1": use extended format? (with subject) # "$@" is passed to list_vim_commits, as extra arguments to git-log. list_missing_vimpatches() { local -a missing_vim_patches=() @@ -442,6 +442,8 @@ list_missing_vimpatches() { # Sets / appends to missing_vim_patches (useful to avoid a subshell when # used multiple times to cache tokens/vim_commit_tags). +# "$1": use extended format? (with subject) +# "$@": extra arguments to git-log. _set_missing_vimpatches() { local token vim_commit vim_tag patch_number declare -a git_log_args -- cgit From dc7f59e04bf711b296fe0e1f0ce2159d0e97c877 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 31 Mar 2020 22:40:33 -0400 Subject: vim-patch.sh: Fix creation of commit list for PR review [ci skip] --- scripts/vim-patch.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index f9726e8a87..e50eb307e5 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -670,9 +670,11 @@ review_pr() { echo echo "Downloading data for pull request #${pr}." - local pr_commit_urls=( - "$(curl -Ssf "https://api.github.com/repos/neovim/neovim/pulls/${pr}/commits" \ - | jq -r '.[].html_url')") + local -a pr_commit_urls + while IFS= read -r pr_commit_url; do + pr_commit_urls+=("$pr_commit_url") + done < <(curl -Ssf "https://api.github.com/repos/neovim/neovim/pulls/${pr}/commits" \ + | jq -r '.[].html_url') echo "Found ${#pr_commit_urls[@]} commit(s)." -- cgit From d26a66a2b310100bac47a57da8b92978a22cb785 Mon Sep 17 00:00:00 2001 From: Kerkko Pelttari Date: Thu, 2 Apr 2020 17:56:14 +0300 Subject: Check for bash version in vim-patch.sh --- scripts/vim-patch.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index f9726e8a87..ba0e7f62dd 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -5,6 +5,12 @@ set -u # Use privileged mode, which e.g. skips using CDPATH. set -p +# Ensure that the user has a bash that supports -A +if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then + echo "Update your bash version to one that supports -A syntax (>3)" + exit 1 +fi + readonly NVIM_SOURCE_DIR="${NVIM_SOURCE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" readonly VIM_SOURCE_DIR_DEFAULT="${NVIM_SOURCE_DIR}/.vim-src" readonly VIM_SOURCE_DIR="${VIM_SOURCE_DIR:-${VIM_SOURCE_DIR_DEFAULT}}" -- cgit From f47e574c875c521244cdb30f271714d4bf20294d Mon Sep 17 00:00:00 2001 From: Kerkko Pelttari Date: Tue, 7 Apr 2020 10:31:26 +0300 Subject: Apply suggestions from code review Improve error message for unsupported bash version, use double square bracket operator Co-Authored-By: Daniel Hahler --- scripts/vim-patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index ba0e7f62dd..e844d2951c 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -6,8 +6,8 @@ set -u set -p # Ensure that the user has a bash that supports -A -if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then - echo "Update your bash version to one that supports -A syntax (>3)" +if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then + echo "This script requires bash version 3 or later (you have ${BASH_VERSION})." >&2 exit 1 fi -- cgit From ed815c61fdc3fa5a0873a3f9005fdf3c5c49e8df Mon Sep 17 00:00:00 2001 From: Poh Zi How Date: Mon, 1 Jun 2020 01:27:05 +0800 Subject: vim-patch.sh: fix bash version-check message #12398 --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/vim-patch.sh') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index a8b622d5c4..9c4349abca 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -7,7 +7,7 @@ set -p # Ensure that the user has a bash that supports -A if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then - echo "This script requires bash version 3 or later (you have ${BASH_VERSION})." >&2 + >&2 echo "error: script requires bash 4+ (you have ${BASH_VERSION})." exit 1 fi -- cgit