From dc250fcc8dc2e5a62247c9ab2f138625e8f14dab Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 24 Oct 2013 00:15:40 -0400 Subject: [PATCH] Add ability to query current Git version --- plugin/fugitive.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 20405bf..8ede56f 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -64,6 +64,15 @@ function! s:shellslash(path) endif endfunction +let s:git_versions = {} + +function! fugitive#git_version(...) abort + if !has_key(s:git_versions, g:fugitive_git_executable) + let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), "\\S\\+\n") + endif + return s:git_versions[g:fugitive_git_executable] +endfunction + function! s:recall() let rev = s:sub(s:buffer().rev(), '^/', '') if rev ==# ':'