Skip to content

Commit

Permalink
Report info for the correct stage
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanderkamp committed Nov 14, 2021
1 parent 0101f49 commit d5edbd7
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions autoload/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2071,18 +2071,29 @@ endfunction

function! s:IndexInfo(dir, commit_stage, path) abort
let result = fugitive#Execute(['--literal-pathspecs', 'ls-files', '--stage', '--', a:path])
let line = result.stdout[0]
if result.exit_status || empty(line)
if result.exit_status
return []
endif
let newftime = getftime(fugitive#Find('.git/index', a:dir))
let [info, filename] = split(line, "\t")
if filename ==# a:path
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 [mode, sha, stage] = split(info, '\s\+')
return [newftime, mode, 'blob', sha, -2]
else
return [newftime, '040000', 'tree', '', 0]
endif
if filename ==# a:path
if stage != a:commit_stage
continue
endif
return [newftime, mode, 'blob', sha, -2]
else
" Not concerned about the stage of tree objects- a tree can contain
" blobs from many different stages simultaneously
return [newftime, '040000', 'tree', '', 0]
endif
endfor
return []
endfunction

function! s:PathInfo(url) abort
Expand Down

0 comments on commit d5edbd7

Please sign in to comment.