mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 21:03:53 -05:00
Report info for the correct stage
This commit is contained in:
@@ -2071,18 +2071,29 @@ endfunction
|
|||||||
|
|
||||||
function! s:IndexInfo(dir, commit_stage, path) abort
|
function! s:IndexInfo(dir, commit_stage, path) abort
|
||||||
let result = fugitive#Execute(['--literal-pathspecs', 'ls-files', '--stage', '--', a:path])
|
let result = fugitive#Execute(['--literal-pathspecs', 'ls-files', '--stage', '--', a:path])
|
||||||
let line = result.stdout[0]
|
if result.exit_status
|
||||||
if result.exit_status || empty(line)
|
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
let newftime = getftime(fugitive#Find('.git/index', a:dir))
|
let newftime = getftime(fugitive#Find('.git/index', a:dir))
|
||||||
|
for line in result.stdout[:2]
|
||||||
|
" Inspect up to the first three lines to find the correct stage
|
||||||
|
if empty(line)
|
||||||
|
break
|
||||||
|
endif
|
||||||
let [info, filename] = split(line, "\t")
|
let [info, filename] = split(line, "\t")
|
||||||
if filename ==# a:path
|
|
||||||
let [mode, sha, stage] = split(info, '\s\+')
|
let [mode, sha, stage] = split(info, '\s\+')
|
||||||
|
if filename ==# a:path
|
||||||
|
if stage != a:commit_stage
|
||||||
|
continue
|
||||||
|
endif
|
||||||
return [newftime, mode, 'blob', sha, -2]
|
return [newftime, mode, 'blob', sha, -2]
|
||||||
else
|
else
|
||||||
|
" Not concerned about the stage of tree objects- a tree can contain
|
||||||
|
" blobs from many different stages simultaneously
|
||||||
return [newftime, '040000', 'tree', '', 0]
|
return [newftime, '040000', 'tree', '', 0]
|
||||||
endif
|
endif
|
||||||
|
endfor
|
||||||
|
return []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:PathInfo(url) abort
|
function! s:PathInfo(url) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user