mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 07:13:52 -05:00
Only query requested path in stage objects
This commit is contained in:
@@ -2075,8 +2075,29 @@ function! s:PathInfo(url) abort
|
||||
return [-1, '000000', '', '', -1]
|
||||
endif
|
||||
let path = substitute(file[1:-1], '/*$', '', '')
|
||||
|
||||
if empty(path)
|
||||
let [_, ftime] = s:TreeInfo(dir, commit)
|
||||
let entry = [ftime, '040000', 'tree', '', -1]
|
||||
elseif commit =~# '^:\=[0-3]$'
|
||||
let result = fugitive#Execute(['--literal-pathspecs', 'ls-files', '--stage', '--', path])
|
||||
let line = result.stdout[0]
|
||||
if result.exit_status || empty(line)
|
||||
return [-1, '000000', '', '', -1]
|
||||
endif
|
||||
let newftime = getftime(fugitive#Find('.git/index', dir))
|
||||
let [info, filename] = split(line, "\t")
|
||||
if filename ==# path
|
||||
let [mode, sha, stage] = split(info, '\s\+')
|
||||
let entry = [newftime, mode, 'blob', sha, -2]
|
||||
else
|
||||
let entry = [newftime, '040000', 'tree', '', 0]
|
||||
endif
|
||||
else
|
||||
let [tree, ftime] = s:TreeInfo(dir, commit)
|
||||
let entry = empty(path) ? [ftime, '040000', 'tree', '', -1] : get(tree, path, [])
|
||||
let entry = get(tree, path, [])
|
||||
endif
|
||||
|
||||
if empty(entry) || file =~# '/$' && entry[2] !=# 'tree'
|
||||
return [-1, '000000', '', '', -1]
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user