diff --git a/git-extra/PKGBUILD b/git-extra/PKGBUILD index d2035ce1c6..7c2d1883a5 100644 --- a/git-extra/PKGBUILD +++ b/git-extra/PKGBUILD @@ -5,7 +5,7 @@ pkgbase="mingw-w64-${_realname}" pkgname=($_realname "${MINGW_PACKAGE_PREFIX}-${_realname}") _ver_base=1.1 -pkgver=1.1.653.48e2403b3 +pkgver=1.1.654.aca5df34e pkgrel=1 pkgdesc="Git for Windows extra files" arch=('any') @@ -62,7 +62,7 @@ source=('inputrc' 'git-askpass.h' 'git-askpass.rc') sha256sums=('8ed76d1cb069ac8568f21c431f5e23caebea502d932ab4cdff71396f4f0d5b72' - 'e36a3b93b8a33b0a74619f2449ed6d56ed54e4e2938b97070bce4926f1f44054' + '7736786309a58112b7ac60627b3df049eb5eac3e0627c364939277477aaa03f1' '640d04d2a2da709419188a986d5e5550ad30df23c7ea9be1a389c37a6b917994' '17c90698d4dd52dd9f383e72aee54ecea0f62520baf56722de5c83285507c0d9' '3cd83627f1d20e1108533419fcf33c657cbcf777c3dc39fa7f13748b7d63858a' diff --git a/git-extra/vimrc b/git-extra/vimrc index 67a5ed1c89..6507568d64 100644 --- a/git-extra/vimrc +++ b/git-extra/vimrc @@ -52,4 +52,36 @@ if has("autocmd") autocmd Filetype diff \ highlight WhiteSpaceEOL ctermbg=red | \ match WhiteSpaceEOL /\(^+.*\)\@<=\s\+$/ + + " When Git starts up, it prepends its libexec dir to PATH to allow it to + " find external commands. + " + " Thus, if Vim is invoked via a Git process (such as the contrib git-jump, + " or any other usage of GIT_EDITOR/VISUAL/EDITOR in Git commands, be they + " scripts or internals--with the exception of manually invoking the script + " yourself, without using Git: sh .../git-jump), $PATH will contain + " something like libexec/git-core. + " + " We don't generally want it in Vim's $PATH, though, as it is passed down + " to *all* subprocesses, including shells started with :terminal or + " :shell. + function s:fix_git_path() abort + let slash = exists('+shellslash') && !&shellslash ? '\\' : '/' + let git_core_base = printf('%slib\%%(exec\)\?%sgit-core', slash, slash) + " optimization: early return + if $PATH !~# git_core_base + return + endif + let path_sep = has('win32') ? ';' : ':' + let new_path = split($PATH, path_sep) + \ ->filter({_, d -> d !~# git_core_base..'$' }) + \ ->join(path_sep) + let $PATH = new_path + endfunction + + augroup fix_git_path + autocmd! + autocmd VimEnter * call s:fix_git_path() + augroup end + endif " has("autocmd")