@@ -174,7 +174,7 @@ preprocess_patch() {
174
174
" $file " > " $file " .tmp && mv " $file " .tmp " $file "
175
175
}
176
176
177
- get_vim_patch () {
177
+ get_vimpatch () {
178
178
get_vim_sources
179
179
180
180
assign_commit_details " ${1} "
@@ -200,7 +200,7 @@ get_vim_patch() {
200
200
}
201
201
202
202
stage_patch () {
203
- get_vim_patch " $1 "
203
+ get_vimpatch " $1 "
204
204
local try_apply=" ${2:- } "
205
205
206
206
local git_remote
@@ -329,31 +329,43 @@ submit_pr() {
329
329
done
330
330
}
331
331
332
- # Prints a newline-delimited list of Vim commits, for use by scripts.
333
- list_vim_patches () {
334
- # Get missing Vim commits
335
- local vim_commits
336
- vim_commits=" $( cd " ${VIM_SOURCE_DIR} " && git log --reverse --format=' %H' v8.0.0000..HEAD) "
332
+ # Gets all Vim commits since the "start" commit.
333
+ list_vim_commits () { (
334
+ cd " ${VIM_SOURCE_DIR} " && git log --reverse --format=' %H' v8.0.0000..HEAD
335
+ ) }
337
336
338
- # Find all "vim-patch:xxx" tokens in the Nvim git log.
337
+ # Prints all "vim-patch:xxx" tokens found in the Nvim git log.
338
+ list_vimpatch_tokens () {
339
339
local tokens
340
+ # Find all "vim-patch:xxx" tokens in the Nvim git log.
340
341
tokens=" $( cd " ${NVIM_SOURCE_DIR} " && git log -E --grep=' vim-patch:[^ ]+' | grep ' vim-patch' ) "
341
- tokens=" $( for i in $tokens ; do echo " $i " | grep -E ' vim-patch:[^ ]{7}' | sed ' s/.*\(vim-patch:[.0-9a-z]\+\).*/\1/' ; done) "
342
+ echo " $tokens " | grep -E ' vim-patch:[^ ,{]{7,}' \
343
+ | sed ' s/.*\(vim-patch:[.0-9a-z]\+\).*/\1/' \
344
+ | sort \
345
+ | uniq
346
+ }
347
+
348
+ # Prints a newline-delimited list of Vim commits, for use by scripts.
349
+ list_missing_vimpatches () {
350
+ local tokens vim_commit vim_commits is_missing vim_tag patch_number
351
+
352
+ # Find all "vim-patch:xxx" tokens in the Nvim git log.
353
+ tokens=" $( list_vimpatch_tokens) "
342
354
343
- local vim_commit
355
+ # Get missing Vim commits
356
+ vim_commits=" $( list_vim_commits) "
344
357
for vim_commit in ${vim_commits} ; do
345
- local is_missing
346
- local vim_tag
347
- # This fails for untagged commits (e.g., runtime file updates) so mask the return status
348
- vim_tag=" $( cd " ${VIM_SOURCE_DIR} " && git describe --tags --exact-match " ${vim_commit} " 2> /dev/null) " || true
349
- if [[ -n " ${vim_tag} " ]]; then
358
+ # Check for vim-patch:<commit_hash> (usually runtime updates).
359
+ is_missing=" $( echo " $tokens " | > /dev/null 2>&1 grep " vim\-patch:${vim_commit: 0: 7} " && echo false || echo true) "
360
+
361
+ if ! [ " $is_missing " = " false" ] \
362
+ && vim_tag=" $( cd " ${VIM_SOURCE_DIR} " && git describe --tags --exact-match " ${vim_commit} " 2> /dev/null) "
363
+ then
350
364
# Vim version number (not commit hash).
351
- local patch_number=" ${vim_tag: 1} " # "v7.4.0001" => "7.4.0001"
365
+ # Check for vim-patch:<tag> (not commit hash).
366
+ patch_number=" ${vim_tag: 1} " # "v7.4.0001" => "7.4.0001"
352
367
is_missing=" $( echo " $tokens " | > /dev/null 2>&1 grep " vim\-patch:${patch_number} " && echo false || echo true) "
353
368
vim_commit=" ${vim_tag# v} "
354
- else
355
- # Untagged Vim patch (e.g. runtime updates).
356
- is_missing=" $( echo " $tokens " | > /dev/null 2>&1 grep " vim\-patch:${vim_commit: 0: 7} " && echo false || echo true) "
357
369
fi
358
370
359
371
if ! [ " $is_missing " = " false" ]; then
@@ -363,11 +375,11 @@ list_vim_patches() {
363
375
}
364
376
365
377
# Prints a human-formatted list of Vim commits, with instructional messages.
366
- show_vim_patches () {
378
+ show_vimpatches () {
367
379
get_vim_sources
368
380
printf " \nVim patches missing from Neovim:\n"
369
381
370
- list_vim_patches | while read vim_commit; do
382
+ list_missing_vimpatches | while read vim_commit; do
371
383
if (cd " ${VIM_SOURCE_DIR} " && git --no-pager show --color=never --name-only " v${vim_commit} " 2> /dev/null) | grep -q ^runtime; then
372
384
printf " • ${vim_commit} (+runtime)\n"
373
385
else
@@ -441,7 +453,7 @@ review_commit() {
441
453
echo " ✔ Saved pull request diff to '${NVIM_SOURCE_DIR} /n${patch_file} '."
442
454
CREATED_FILES+=(" ${NVIM_SOURCE_DIR} /n${patch_file} " )
443
455
444
- get_vim_patch " ${vim_version} "
456
+ get_vimpatch " ${vim_version} "
445
457
CREATED_FILES+=(" ${NVIM_SOURCE_DIR} /${patch_file} " )
446
458
447
459
echo
@@ -489,11 +501,11 @@ while getopts "hlLVp:P:g:r:s" opt; do
489
501
exit 0
490
502
;;
491
503
l)
492
- show_vim_patches
504
+ show_vimpatches
493
505
exit 0
494
506
;;
495
507
L)
496
- list_vim_patches
508
+ list_missing_vimpatches
497
509
exit 0
498
510
;;
499
511
p)
@@ -505,7 +517,7 @@ while getopts "hlLVp:P:g:r:s" opt; do
505
517
exit 0
506
518
;;
507
519
g)
508
- get_vim_patch " ${OPTARG} "
520
+ get_vimpatch " ${OPTARG} "
509
521
exit 0
510
522
;;
511
523
r)
0 commit comments