From 0d92bf376170dd6c311f1e7dfefb323e336ff8eb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 17 Jul 2026 07:16:31 -0400 Subject: [PATCH] build(vim-patch): '#ifdef FEAT_' tweaking is N/A #40785 Filter out `#ifdef` line changes when analyzing C files (*.c, *.h) via git "-I" flag. ``` -I --ignore-matching-lines= Ignore changes whose all lines match . This option may be specified more than once. ``` - https://git-scm.com/docs/diff-options#Documentation/diff-options.txt--Iregex --- scripts/vim-patch.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index a69c3a9386..55c80efe13 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -926,8 +926,12 @@ is_na_patch() { grep -Pzc "@@\n-${RT_TITLE_PAT}\+${RT_TITLE_PAT}$")" || true test "$RT_TITLE_NUM" -ne 1 && return 1 ;; + *.h) + HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r '-I^#\s*(else|endif)' '-I^#\s*(ifdef|if.*defined\().*FEAT_' "$patch" -- "${file}") + test -n "${HUNKS}" && return 1 + ;; *.c) - HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r "$patch" -- "$file" | grep -P '^@@ .* @@') + HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r '-I^#\s*(else|endif)' '-I^#\s*(ifdef|if.*defined\().*FEAT_' "$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