diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 286aaaea9e..6f71f15ddf 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -382,12 +382,21 @@ list_vimpatch_numbers() { list_missing_vimpatches() { local token vim_commit vim_tag patch_number declare -A tokens + declare -A vim_commit_tags # 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:lstrip=2)' \ + --sort='-*authordate' \ + --shell) + )" + # Get missing Vim commits for vim_commit in $(list_vim_commits); do # Check for vim-patch: (usually runtime updates). @@ -396,7 +405,8 @@ list_missing_vimpatches() { continue fi - if vim_tag="$(git -C "${VIM_SOURCE_DIR}" describe --tags --exact-match "${vim_commit}" 2>/dev/null)"; then + vim_tag="${vim_commit_tags[$vim_commit]-}" + if [[ -n "$vim_tag" ]]; then # Check for vim-patch: (not commit hash). patch_number="vim-patch:${vim_tag:1}" # "v7.4.0001" => "7.4.0001" if [[ "${tokens[$patch_number]-}" ]]; then