fix(vim-patch): :redrawtabpanel regexp, delay grep on hunk

Too many suggestions in
bcf116cc2f

Multi-line grep on the hunk contents before filtering by hunk header
prevents vim-patch.sh from detecting v8.1.2195 and v8.1.2219 as N/A.

Revisit multi-line parsing for `runtime/doc/*.txt`
when Vim v9.2+ has new runtime/doc/ patches
about features that require "has()/exists()" guards.
This commit is contained in:
Jan Edmund Lazo
2026-08-20 20:55:48 -04:00
parent 40740f49f8
commit 03ec1b37d3

View File

@@ -928,11 +928,12 @@ is_na_patch() {
for file in $FILES_REMAINING; do
case ${file} in
runtime/doc/*.txt | runtime/pack/dist/opt/*/doc/*.txt)
# TODO(@janlazo): ignore (multi-line) phrases based on regexp '{.\+ \(available\|compiled\) \(with\|without\) .\+}'
HUNKS=$(git -c core.attributesfile="$NVIM_SOURCE_DIR"/.gitattributes -c 'diff.helphelp.xfuncname=^.*\*[^*]+\*$' -C "${VIM_SOURCE_DIR}" \
diff-tree --no-commit-id -r -b -U0 \
'-I^\s+$' \
'-I^=+$' \
'-I^\|:redrawtabpanel|' \
'-I^\|:redrawtabpanel\|' \
'-I^\|popup_[_a-z]+\(\)\|' \
'-I^popup_[_a-z]+\(' \
'-I\*\s+For Vim version [0-9]\.[0-9]\.\s+Last change: [0-9]+ [A-Z][a-z]+ [0-9]+' \
@@ -940,12 +941,9 @@ is_na_patch() {
'-I\|popup-windows\|' \
'-I\|tabpanel\|' \
'-I\spopup window\s' \
"$patch" -- "${file}" |
grep -v -e '{.\+ \(available\|compiled\) \(with\|without\) .\+}' |
grep -Pzo '(?<=\n)@@ -[0-9][^@\n]+\+[0-9][^@\n]* @@[^@\n]*\n(?=([-+][^\n]*\n)+(@|$))' |
tr '\0' '\n')
"$patch" -- "${file}")
if test -n "$HUNKS"; then
HUNK_NUM_FINAL=$(echo "$HUNKS" | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_VIM")
HUNK_NUM_FINAL=$(echo "$HUNKS" | grep '^@@ .* @@' | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_VIM")
test "$HUNK_NUM_FINAL" -ne 0 && return 1
fi
;;
@@ -1001,10 +999,9 @@ is_na_patch() {
'-I\slist_T\s+\*w_popup_mask;' \
'-I\spopclose_T\sw_popup_close;' \
'-I\s\*?w_popup_prop_[_a-z]+;' \
"$patch" -- "${file}" |
grep '^@@ .* @@')
"$patch" -- "${file}")
if test -n "$HUNKS"; then
HUNK_NUM_FINAL=$(echo "$HUNKS" | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_H")
HUNK_NUM_FINAL=$(echo "$HUNKS" | grep '^@@ .* @@' | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_H")
test "$HUNK_NUM_FINAL" -ne 0 && return 1
fi
;;
@@ -1031,10 +1028,9 @@ is_na_patch() {
'-Icrypt_get_method_nr\(.+\)' \
'-I\spopup_set_firstline\(.+\);' \
'-I\svim_free\(.*w_popup_title\);' \
"$patch" -- "${file}" |
grep '^@@ .* @@')
"$patch" -- "${file}")
if test -n "$HUNKS"; then
HUNK_NUM_FINAL=$(echo "$HUNKS" | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_C")
HUNK_NUM_FINAL=$(echo "$HUNKS" | grep '^@@ .* @@' | sed 's/^@@ .* @@ //' | grep -cv -f "$NA_HUNKS_C")
test "$HUNK_NUM_FINAL" -ne 0 && return 1
fi
;;