diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 647d304c2a..a69c3a9386 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -911,20 +911,32 @@ is_na_patch() { local NA_FILELIST="$NVIM_SOURCE_DIR/scripts/vim_na_files.txt" local NA_HUNKS_C="$NVIM_SOURCE_DIR/scripts/vim_na_hunks_c.txt" - local FILES_REMAINING C_FILES + local FILES_REMAINING HUNKS HUNK_NUM_FINAL RT_NUMSTAT RT_TITLE_PAT RT_TITLE_NUM FILES_REMAINING="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" | grep '^<' | sed 's/^< //')" || true test -z "$FILES_REMAINING" && return 0 - C_FILES=$(echo "$FILES_REMAINING" | grep '.*\.c$') - test "$FILES_REMAINING" != "$C_FILES" && return 1 - - for file in $C_FILES; do - 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 + for file in $FILES_REMAINING; do + case ${file} in + runtime/doc/*.txt) + RT_NUMSTAT=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --numstat -r "$patch" -- "${file}" | grep -c '^1\s\+1\s\+') + test "${RT_NUMSTAT}" -ne 1 && return 1 + RT_TITLE_PAT="\*$(basename "${file}")\*\s+For Vim version [0-9]\.[0-9]\.\s+Last change: [0-9]+ [A-Z][a-z]+ [0-9]+\n" + RT_TITLE_NUM="$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r "$patch" -- "${file}" | + grep -Pzc "@@\n-${RT_TITLE_PAT}\+${RT_TITLE_PAT}$")" || true + test "$RT_TITLE_NUM" -ne 1 && return 1 + ;; + *.c) + 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 + ;; + *) + return 1 + ;; + esac done return 0 diff --git a/scripts/vim_na_files.txt b/scripts/vim_na_files.txt index d333b19f42..39a425dd86 100644 --- a/scripts/vim_na_files.txt +++ b/scripts/vim_na_files.txt @@ -138,6 +138,7 @@ src/testdir/util/vms.vim src/typemap src/uninstall.c src/version.h +src/vim.def src/vimrun.c src/winclip.c uninstall.txt diff --git a/scripts/vim_na_regexp.txt b/scripts/vim_na_regexp.txt index 84e2828721..9588285bc4 100644 --- a/scripts/vim_na_regexp.txt +++ b/scripts/vim_na_regexp.txt @@ -6,7 +6,7 @@ ^pixmaps/ ^runtime/colors/tools/ ^runtime/doc/gui_ -^runtime/doc/version[4-6]\.txt +^runtime/doc/version[4-8]\.txt ^runtime/doc/vim9 ^runtime/hi[1-9] ^runtime/icons @@ -38,6 +38,7 @@ ^src/GvimExt/ ^src/INSTALL ^src/Make +^src/VisVim/ ^src/[a-z]\+_cmdidxs\.h$ ^src/auto/ ^src/beval @@ -46,6 +47,7 @@ ^src/configure ^src/crypt ^src/gui[_.] +^src/gvim ^src/if_ ^src/install ^src/json[_.]