mirror of
https://github.com/neovim/neovim.git
synced 2026-01-03 09:56:25 +10:00
fix(vim-patch.sh): don't treat 1-file runtime-only patch as N/A (#36525)
If the patch in question does not change src/version.c, `git log -1` instead shows the previous patch that changes src/version.c, which causes 1-file runtime-only patches to be considered N/A. Check that the remaining file is src/version.c to fix this problem. Also use `git diff-tree` instead of `git log -1` for version.c.
This commit is contained in:
@@ -892,21 +892,20 @@ is_na_patch() {
|
||||
local NA_REGEXP="$NVIM_SOURCE_DIR/scripts/vim_na_regexp.txt"
|
||||
local NA_FILELIST="$NVIM_SOURCE_DIR/scripts/vim_na_files.txt"
|
||||
|
||||
local FILE_LNUM
|
||||
# shellcheck disable=SC2086
|
||||
FILE_LNUM="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" |
|
||||
grep -c '^<')" || FILE_LNUM=0
|
||||
test "$FILE_LNUM" -gt 1 && return 1
|
||||
if test "$FILE_LNUM" -eq 1; then
|
||||
local FILES_REMAINING
|
||||
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
|
||||
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}" log -1 --numstat --format= "$patch" -- src/version.c | grep -c '^2\s\+0')
|
||||
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}" log -1 -U1 --format="" "$patch" -- src/version.c |
|
||||
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" -ne 1 && return 1
|
||||
test "$VERSION_VNUM" -eq 1 && return 0
|
||||
fi
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
list_na_patches() {
|
||||
|
||||
Reference in New Issue
Block a user