motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit dc579a0dfbfacbfee865b1486f5717a286a92fcb (tree)
parent e9f913ff8a6f76062e0aa95b60d740ec690f6f4f
Author: Tim Pope <code@tpope.net>
Date:   Thu, 29 Jul 2021 08:27:44 -0400

Don't trust git --version with nonzero exit status

This prevents parsing `zsh:1: command not found: git` as version "1:".

References: https://github.com/tpope/vim-fugitive/issues/1801

Diffstat:
Mautoload/fugitive.vim | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -321,7 +321,8 @@ let s:git_versions = {} function! fugitive#GitVersion(...) abort let git = s:GitShellCmd() if !has_key(s:git_versions, git) - let s:git_versions[git] = matchstr(s:SystemError(s:GitCmd() + ['--version'])[0], '\d[^[:space:]]\+') + let [out, exec_error] = s:SystemError(s:GitCmd() + ['--version']) + let s:git_versions[git] = exec_error ? '' : matchstr(out, '\d[^[:space:]]\+') endif if !a:0 return s:git_versions[git]