vim-patch.sh: improve performance #10137

`vim-patch.sh -L`: down to ~0.5s from ~85s.
`vim-patch.sh -l`: down to ~6s from ~90s.

    % diff old new:
    193c193
    <   • v8.0.1366
    ---
    >   • v8.0.1367
    354d353
    <   • v8.0.1738

This is due to duplicate tags for Vim commits
(https://github.com/vim/vim/issues/4510):

  - vim/vim@1ad022a9b: tagged as v8.0.1367, v8.0.1366
  - vim/vim@5d69da462: tagged as v8.0.1739, v8.0.1738
This commit is contained in:
Daniel Hahler
2019-06-08 14:18:35 +02:00
committed by Justin M. Keyes
parent 25ec0c8805
commit bf16b14f46

View File

@@ -382,12 +382,21 @@ list_vimpatch_numbers() {
list_vimpatch_tokens | while read -r vimpatch_token; do list_vimpatch_tokens | while read -r vimpatch_token; do
echo "$vimpatch_token" | grep '8\.0\.' | sed 's/.*vim-patch:8\.0\.\([0-9a-z]\+\).*/\1/' echo "$vimpatch_token" | grep '8\.0\.' | sed 's/.*vim-patch:8\.0\.\([0-9a-z]\+\).*/\1/'
done done
}
# Prints a newline-delimited list of Vim commits, for use by scripts. # Prints a newline-delimited list of Vim commits, for use by scripts.
list_missing_vimpatches() { list_missing_vimpatches() {
local token vim_commit vim_tag patch_number local token vim_commit vim_tag patch_number
declare -A tokens declare -A tokens
declare -A vim_commit_tags 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 \ $(git -C "${VIM_SOURCE_DIR}" for-each-ref refs/tags \
--format '[%(objectname)]=%(refname:lstrip=2)' \ --format '[%(objectname)]=%(refname:lstrip=2)' \
--sort='-*authordate' \ --sort='-*authordate' \
@@ -396,7 +405,8 @@ list_missing_vimpatches() {
# Get missing Vim commits # Get missing Vim commits
for vim_commit in $(list_vim_commits); do for vim_commit in $(list_vim_commits); do
# Check for vim-patch:<commit_hash> (usually runtime updates). # Check for vim-patch:<commit_hash> (usually runtime updates).
token="vim-patch:${vim_commit:0:7}"
if [[ "${tokens[$token]-}" ]]; then if [[ "${tokens[$token]-}" ]]; then
continue continue
fi fi