mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Ignore dot files when globbing
This commit is contained in:
@@ -821,12 +821,19 @@ function! fugitive#writefile(lines, url, ...) abort
|
||||
return call('writefile', [a:lines, a:url] + a:000)
|
||||
endfunction
|
||||
|
||||
let s:globsubs = {'*': '[^/]*', '**': '.*', '**/': '\%(.*/\)\=', '?': '[^/]'}
|
||||
let s:globsubs = {
|
||||
\ '/**/': '/\%([^./][^/]*/\)*',
|
||||
\ '/**': '/\%([^./][^/]\+/\)*[^./][^/]*',
|
||||
\ '**/': '[^/]*\%(/[^./][^/]*\)*',
|
||||
\ '**': '.*',
|
||||
\ '/*': '/[^/.][^/]*',
|
||||
\ '*': '[^/]*',
|
||||
\ '?': '[^/]'}
|
||||
function! fugitive#glob(url, ...) abort
|
||||
let [dirglob, commit, glob] = s:DirCommitFile(a:url)
|
||||
let append = matchstr(glob, '/*$')
|
||||
let glob = substitute(glob, '/*$', '', '')
|
||||
let pattern = '^' . substitute(glob[1:-1], '\*\*/\=\|[.?*\^$]', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g') . '$'
|
||||
let pattern = '^' . substitute(glob, '/\=\*\*/\=\|/\=\*\|[.?\^$]', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g')[1:-1] . '$'
|
||||
let results = []
|
||||
for dir in dirglob =~# '[*?]' ? split(glob(dirglob), "\n") : [dirglob]
|
||||
if empty(dir) || !get(g:, 'fugitive_file_api', 1) || !filereadable(dir . '/HEAD')
|
||||
|
||||
Reference in New Issue
Block a user