mirror of
https://github.com/neovim/neovim.git
synced 2026-07-13 21:00:42 +00:00
Merge #40473 from janlazo/vimpatch_na_cfuncs
build(vim-patch): detect N/A C files based on diff
This commit is contained in:
@@ -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() {
|
||||
|
||||
54
scripts/vim_na_hunks_c.txt
Normal file
54
scripts/vim_na_hunks_c.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
^change_compatible(
|
||||
^check_restricted(
|
||||
^compatible_set(void)
|
||||
^did_set_compatible(
|
||||
^did_set_cscopequickfix(
|
||||
^did_set_imactivatekey(
|
||||
^did_set_imdisable(
|
||||
^did_set_imstyle(
|
||||
^did_set_insertmode(
|
||||
^did_set_keyprotocol(
|
||||
^did_set_maxcombine(
|
||||
^did_set_pastetoggle(
|
||||
^did_set_printencoding(
|
||||
^did_set_showtabpanel(
|
||||
^did_set_swapsync(
|
||||
^did_set_toolbar[a-zA-Z0-9_]\+(
|
||||
^did_set_ttymouse(
|
||||
^do_fixdel(
|
||||
^ex_behave(
|
||||
^ex_open(
|
||||
^ex_scriptversion(
|
||||
^ex_shell(
|
||||
^ex_smile(
|
||||
^ex_tearoff(
|
||||
^f_err_teapot(
|
||||
^f_listener_add(
|
||||
^f_redraw_listener_add(
|
||||
^f_test_alloc_fail(
|
||||
^f_test_autochdir(
|
||||
^f_test_feedinput(
|
||||
^f_test_garbagecollect_soon(
|
||||
^f_test_getvalue(
|
||||
^f_test_ignore_error(
|
||||
^f_test_null_channel(
|
||||
^f_test_null_job(
|
||||
^f_test_option_not_set(
|
||||
^f_test_override(
|
||||
^f_test_scrollbar(
|
||||
^f_test_setmouse(
|
||||
^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_]\+(
|
||||
clip_xterm_[a-zA-Z0-9_]\+(
|
||||
crypt(
|
||||
crypt[a-zA-Z0-9_]\+(
|
||||
gui_mch_[a-zA-Z0-9_]\+(
|
||||
mch_kitty_probe(
|
||||
mzscheme_call_vim(
|
||||
text_prop[a-zA-Z0-9_]\+(
|
||||
x11_[a-zA-Z0-9_]\+(
|
||||
Reference in New Issue
Block a user