build(vim-patch): version.c "included_patches[]" is N/A

Nvim relies on commit history for automated updates
to ported Vim patches across Vim releases via "included_patchsets[]".
Each Vim commit is suppose to manually adjust "included_patches[]"
but it is prone to human error such that vim-patch.sh found
the following N/A commits:

```
495282b6e Correct list of patch numbers
85d9b03f8 Correct list of patches.
```

Prior to this commit, vim-patch doesn't find the following N/A commit:

```
9.0.2172: Vim9: compiling :defer may fail
```

https://github.com/neovim/neovim/pull/40519#issuecomment-4850337525
This commit is contained in:
Jan Edmund Lazo
2026-07-05 20:47:47 -04:00
parent 384a9c451a
commit e618d279b8
2 changed files with 6 additions and 14 deletions

View File

@@ -901,7 +901,7 @@ is_na_patch() {
local patch=$1
local NA_REGEXP="$NVIM_SOURCE_DIR/scripts/vim_na_regexp.txt"
local NA_FILELIST="$NVIM_SOURCE_DIR/scripts/vim_na_files.txt"
local NA_CFUNC_LIST="$NVIM_SOURCE_DIR/scripts/vim_na_cfuncs.txt"
local NA_HUNKS_C="$NVIM_SOURCE_DIR/scripts/vim_na_hunks_c.txt"
local FILES_REMAINING C_FILES
FILES_REMAINING="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" |
@@ -911,20 +911,11 @@ is_na_patch() {
C_FILES=$(echo "$FILES_REMAINING" | grep '.*\.c$')
test "$FILES_REMAINING" != "$C_FILES" && return 1
local VERSION_LNUM VERSION_VNUM
for file in $C_FILES; do
if test "$file" == "src/version.c"; then
VERSION_LNUM=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --numstat -r "$patch" -- src/version.c | grep -c '^2\s\+0')
test "$VERSION_LNUM" -ne 1 && return 1
VERSION_VNUM="$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U1 -r "$patch" -- src/version.c |
grep -Pzc '[ +]\/\*\*\/\n\+\s+[0-9]+,\n[ +]\/\*\*\/\n')" || true
test "$VERSION_VNUM" -ne 1 && return 1
else
HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r "$patch" -- "$file" | grep -P '^@@ .* @@')
if test -n "$HUNKS"; then
HUNK_NUM_FINAL=$(echo "$HUNKS" | sed 's/^@@ .* @@ \?//' | grep -cv -f "$NA_CFUNC_LIST")
test "$HUNK_NUM_FINAL" -ne 0 && return 1
fi
HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r "$patch" -- "$file" | grep -P '^@@ .* @@')
if test -n "$HUNKS"; then
HUNK_NUM_FINAL=$(echo "$HUNKS" | sed 's/^@@ .* @@ \?//' | grep -cv -f "$NA_HUNKS_C")
test "$HUNK_NUM_FINAL" -ne 0 && return 1
fi
done

View File

@@ -26,6 +26,7 @@
^f_test_settime(
^f_test_srand_seed(
^f_test_void(
^static int included_patches\[\] =
_balloon[a-zA-Z0-9_]\+(
_tabpanelopt(
bevalterm[a-zA-Z0-9_]\+(