aboutsummaryrefslogtreecommitdiff
path: root/scripts/vim-patch.sh
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-06-08 14:18:35 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-06-08 14:18:35 +0200
commitbf16b14f46b9698becd46bb4e1751319219358b7 (patch)
tree3ffa5973c9c433efe58db3ca949a103b14ad9091 /scripts/vim-patch.sh
parent25ec0c8805f23f116d75d72fe8d1faeb02c64080 (diff)
downloadrneovim-bf16b14f46b9698becd46bb4e1751319219358b7.tar.gz
rneovim-bf16b14f46b9698becd46bb4e1751319219358b7.tar.bz2
rneovim-bf16b14f46b9698becd46bb4e1751319219358b7.zip
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
Diffstat (limited to 'scripts/vim-patch.sh')
-rwxr-xr-xscripts/vim-patch.sh12
1 files changed, 11 insertions, 1 deletions
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:<commit_hash> (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:<tag> (not commit hash).
patch_number="vim-patch:${vim_tag:1}" # "v7.4.0001" => "7.4.0001"
if [[ "${tokens[$patch_number]-}" ]]; then