mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-10 04:23:46 -05:00
Adjust handling of 'buftype' during detection
This commit is contained in:
@@ -23,16 +23,16 @@ function! FugitiveGitDir(...) abort
|
|||||||
return g:fugitive_event
|
return g:fugitive_event
|
||||||
endif
|
endif
|
||||||
let dir = get(b:, 'git_dir', '')
|
let dir = get(b:, 'git_dir', '')
|
||||||
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
|
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|quickfix\|terminal\|prompt\)$')
|
||||||
return FugitiveExtractGitDir(getcwd())
|
return FugitiveExtractGitDir(getcwd())
|
||||||
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
|
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && &buftype =~# '^\%(nowrite\|acwrite\)\=$'
|
||||||
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
|
let b:git_dir = FugitiveExtractGitDir(bufnr(''))
|
||||||
return b:git_dir
|
return b:git_dir
|
||||||
endif
|
endif
|
||||||
return dir =~# s:bad_git_dir ? '' : dir
|
return dir =~# s:bad_git_dir ? '' : dir
|
||||||
elseif type(a:1) == type(0) && a:1 isnot# 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)
|
if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && &buftype =~# '^\%(nowrite\|acwrite\)\=$'
|
||||||
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
|
let b:git_dir = FugitiveExtractGitDir(a:1)
|
||||||
endif
|
endif
|
||||||
let dir = getbufvar(a:1, 'git_dir')
|
let dir = getbufvar(a:1, 'git_dir')
|
||||||
return dir =~# s:bad_git_dir ? '' : dir
|
return dir =~# s:bad_git_dir ? '' : dir
|
||||||
@@ -405,7 +405,7 @@ function! FugitiveExtractGitDir(path) abort
|
|||||||
if type(a:path) ==# type({})
|
if type(a:path) ==# type({})
|
||||||
return get(a:path, 'git_dir', '')
|
return get(a:path, 'git_dir', '')
|
||||||
elseif type(a:path) == type(0)
|
elseif type(a:path) == type(0)
|
||||||
let path = s:Slash(a:path >= 0 ? bufname(a:path) : bufname(''))
|
let path = s:Slash(a:path > 0 ? bufname(a:path) : bufname(''))
|
||||||
else
|
else
|
||||||
let path = s:Slash(a:path)
|
let path = s:Slash(a:path)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user