diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-07-12 12:13:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-12 12:13:20 -0400 |
| commit | 17f13ab338f92fa5086ca769f10bd87fc9503f41 (patch) | |
| tree | 02a73a385a4d4262f7cfef337ce298e40c951bcd /scripts/vim-patch.sh | |
| parent | 81c4c295ac78c2baa1b905d9bc75c9bcdc3fd54b (diff) | |
| parent | 4713f0e9eb4e4927d3ae9fcdc7d365f2a9d727e3 (diff) | |
| download | rneovim-17f13ab338f92fa5086ca769f10bd87fc9503f41.tar.gz rneovim-17f13ab338f92fa5086ca769f10bd87fc9503f41.tar.bz2 rneovim-17f13ab338f92fa5086ca769f10bd87fc9503f41.zip | |
Merge #40473 from janlazo/vimpatch_na_cfuncs
build(vim-patch): detect N/A C files based on diff
Diffstat (limited to 'scripts/vim-patch.sh')
| -rwxr-xr-x | scripts/vim-patch.sh | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 83abfe58fb..647d304c2a 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -909,21 +909,25 @@ 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_HUNKS_C="$NVIM_SOURCE_DIR/scripts/vim_na_hunks_c.txt" - local FILES_REMAINING + 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" | - grep '^<')" || true + grep '^<' | sed 's/^< //')" || true test -z "$FILES_REMAINING" && return 0 - if test "$FILES_REMAINING" == "$(printf "< src/version.c\n")"; then - local VERSION_LNUM - 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 - local VERSION_VNUM - 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" -eq 1 && return 0 - fi - return 1 + + 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 + done + + return 0 } list_na_patches() { |