From 4e6b7b6ce9beac6533790392ed869793802604cd Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 21 Aug 2021 19:19:55 -0400 Subject: [PATCH] Don't accept 0 to refer to alternate buffer This allows a sensible interpretation when using 0 as a stand-in for "false". You can use bufnr('#') if you need the old behavior. --- plugin/fugitive.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 4cd3ef1..2a2ee9f 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -18,7 +18,7 @@ let s:bad_git_dir = '/$\|^fugitive:' function! FugitiveGitDir(...) abort if v:version < 704 return '' - elseif !a:0 || type(a:1) == type(0) && a:1 < 0 + elseif !a:0 || type(a:1) == type(0) && a:1 < 0 || a:1 is# get(v:, 'true', -1) if exists('g:fugitive_event') return g:fugitive_event endif @@ -30,7 +30,7 @@ function! FugitiveGitDir(...) abort return b:git_dir endif return dir =~# s:bad_git_dir ? '' : dir - elseif type(a:1) == type(0) + elseif type(a:1) == type(0) && a:1 isnot# 0 if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype) let b:git_dir = FugitiveExtractGitDir(expand('%:p')) endif