diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 55c80efe13..9942131b74 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -912,26 +912,26 @@ is_na_patch() { local NA_HUNKS_C="$NVIM_SOURCE_DIR/scripts/vim_na_hunks_c.txt" local FILES_REMAINING HUNKS HUNK_NUM_FINAL RT_NUMSTAT RT_TITLE_PAT RT_TITLE_NUM - FILES_REMAINING="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" | + FILES_REMAINING="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -r -b --name-only "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" | grep '^<' | sed 's/^< //')" || true test -z "$FILES_REMAINING" && return 0 for file in $FILES_REMAINING; do case ${file} in runtime/doc/*.txt) - RT_NUMSTAT=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --numstat -r "$patch" -- "${file}" | grep -c '^1\s\+1\s\+') + RT_NUMSTAT=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -r -b --numstat "$patch" -- "${file}" | grep -c '^1\s\+1\s\+') test "${RT_NUMSTAT}" -ne 1 && return 1 RT_TITLE_PAT="\*$(basename "${file}")\*\s+For Vim version [0-9]\.[0-9]\.\s+Last change: [0-9]+ [A-Z][a-z]+ [0-9]+\n" - RT_TITLE_NUM="$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -U0 -r "$patch" -- "${file}" | + RT_TITLE_NUM="$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -r -b -U0 "$patch" -- "${file}" | 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}") + HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -r -b -U0 '-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 '-I^#\s*(else|endif)' '-I^#\s*(ifdef|if.*defined\().*FEAT_' "$patch" -- "$file" | grep -P '^@@ .* @@') + HUNKS=$(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id -r -b -U0 '-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