From 3d5d2ad4a933a9cbd391befe61a4145ae1d1ebb2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 24 Jul 2026 08:37:47 -0400 Subject: [PATCH] fix(vim-patch.sh): omit gpg for git-log #37173 "vim-patch.sh -L" includes gpg signature for "log.showSignature=true" in user's .gitconfig. vim-patch.sh expects no signature for 1-line output per patch. --- scripts/vim-patch.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 698208e92f..9c1f0a5172 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -52,6 +52,13 @@ usage() { echo " $0 -l -- src/edit.c" } +# Run git with inline config to avoid error with developer's .gitconfig. +_git() { + local -a git_args + git_args=("$@") + git -c log.showSignature=false "${git_args[@]}" +} + msg_ok() { printf '\e[32m✔\e[0m %s\n' "$@" } @@ -163,7 +170,7 @@ assign_commit_details() { local munge_commit_line=false fi - local get_vim_commit_cmd="git -C ${VIM_SOURCE_DIR} log -1 --format=%H ${vim_commit_ref} --" + local get_vim_commit_cmd="_git -C ${VIM_SOURCE_DIR} log -1 --format=%H ${vim_commit_ref} --" vim_commit=$($get_vim_commit_cmd 2>&1) || { # Update Vim sources. get_vim_sources update @@ -174,10 +181,10 @@ assign_commit_details() { } vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}" - vim_message="$(git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:%B' "${vim_commit}" \ + vim_message="$(_git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:%B' "${vim_commit}" \ | sed -Ee 's/([^A-Za-z0-9])(#[0-9]{1,})/\1vim\/vim\2/g')" local vim_coauthor0 - vim_coauthor0="$(git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:Co-authored-by: %an <%ae>' "${vim_commit}")" + vim_coauthor0="$(_git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:Co-authored-by: %an <%ae>' "${vim_commit}")" # Extract co-authors from the commit message. vim_coauthors="$(echo "${vim_message}" | (grep -E '^Co-[Aa]uthored-[Bb]y: ' || true) | (grep -Fxv "${vim_coauthor0}" || true))" vim_coauthors="$(echo "${vim_coauthor0}"; echo "${vim_coauthors}")" @@ -513,10 +520,10 @@ submit_pr() { local nvim_remote nvim_remote="$(find_git_remote)" local pr_body - pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${nvim_remote}"/master..HEAD)" + pr_body="$(_git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${nvim_remote}"/master..HEAD)" local patches # Extract just the "vim-patch:X.Y.ZZZZ" or "vim-patch:sha" portion of each log - patches=("$(git log --grep=vim-patch --reverse --format='%s' "${nvim_remote}"/master..HEAD | sed 's/: .*//')") + patches=("$(_git log --grep=vim-patch --reverse --format='%s' "${nvim_remote}"/master..HEAD | sed 's/: .*//')") # shellcheck disable=SC2206 patches=(${patches[@]//vim-patch:}) # Remove 'vim-patch:' prefix for each item in array. local pr_title="${patches[*]}" # Create space-separated string from array. @@ -569,13 +576,13 @@ submit_pr() { # Gets all Vim commits since the "start" commit. list_vim_commits() { ( - cd "${VIM_SOURCE_DIR}" && git log --reverse v8.1.0000..HEAD "$@" + cd "${VIM_SOURCE_DIR}" && _git log --reverse v8.1.0000..HEAD "$@" ) } # Prints all (sorted) "vim-patch:xxx" tokens found in the Nvim git log. list_vimpatch_tokens() { # Use sed…{7,7} to normalize (internal) Git hashes (for tokens caches). - git -C "${NVIM_SOURCE_DIR}" log -E --grep='vim-patch:[^ ,{]{7,}' \ + _git -C "${NVIM_SOURCE_DIR}" log -E --grep='vim-patch:[^ ,{]{7,}' \ | grep -oE 'vim-patch:[^ ,{:]{7,}' \ | sort \ | uniq \ @@ -591,7 +598,7 @@ list_vimpatch_tokens() { list_vimpatch_numbers() { local patch_pat='(8\.[12]|9\.[0-9])\.[0-9]{1,4}' diff "${NVIM_SOURCE_DIR}/scripts/vimpatch_token_reverts.txt" <( - git -C "${NVIM_SOURCE_DIR}" log --format="%s%n%b" -E --grep="^[* ]*vim-patch:${patch_pat}" | + _git -C "${NVIM_SOURCE_DIR}" log --format="%s%n%b" -E --grep="^[* ]*vim-patch:${patch_pat}" | grep -oE "^[* ]*vim-patch:${patch_pat}" | sed -nEe 's/^[* ]*vim-patch:('"${patch_pat}"').*$/\1/p' | awk '{split($0, a, "."); printf "%d.%d.%04d\n", a[1], a[2], a[3]}' | @@ -720,7 +727,7 @@ show_vimpatches() { printf "Vim patches missing from Neovim:\n" local -A runtime_commits - for commit in $(git -C "${VIM_SOURCE_DIR}" log --format="%H %D" -- runtime | sed -Ee 's/,\? tag: / /g'); do + for commit in $(_git -C "${VIM_SOURCE_DIR}" log --format="%H %D" -- runtime | sed -Ee 's/,\? tag: / /g'); do runtime_commits[$commit]=1 done @@ -955,7 +962,7 @@ is_na_patch() { list_na_patches() { list_missing_vimpatches 0 | while read -r patch; do if is_na_patch "$patch"; then - GIT_MSG="$(git -C "${VIM_SOURCE_DIR}" log -1 --oneline "$patch")" + GIT_MSG="$(_git -C "${VIM_SOURCE_DIR}" log -1 --oneline "$patch")" if (echo "$patch" | grep -q '^v[0-9]\.[0-9]\.[0-9]') && (echo "${GIT_MSG}" | grep -q ' patch [0-9]\.'); then # shellcheck disable=SC2001 echo "vim-patch:$(echo "${GIT_MSG}" | sed 's/^[0-9a-zA-Z]\+ patch //')"