From a3e951818621773ccfc7d9d8a86b38808082550d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 6 Aug 2018 16:38:30 -0400 Subject: [PATCH] Fix file API to distinguish between commits --- autoload/fugitive.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 7d9e86c..bdc11ed 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -588,23 +588,26 @@ function! s:TreeInfo(dir, commit) abort return [get(s:indexes[a:dir][1], a:commit[-1:-1], {}), newftime] elseif a:commit =~# '^\x\{40\}$' if !has_key(s:trees, a:dir) + let s:trees[a:dir] = {} + endif + if !has_key(s:trees[a:dir], a:commit) let ftime = +system(git . ' log -1 --pretty=format:%ct ' . a:commit) if v:shell_error - let s:trees[a:dir] = [{}, -1] - return s:trees[a:dir] + let s:trees[a:dir][a:commit] = [{}, -1] + return s:trees[a:dir][a:commit] endif - let s:trees[a:dir] = [{}, +ftime] + let s:trees[a:dir][a:commit] = [{}, +ftime] let out = system(git . ' ls-tree -rtl --full-name ' . a:commit) if v:shell_error - return s:trees[a:dir] + return s:trees[a:dir][a:commit] endif for line in split(out, "\n") let [info, filename] = split(line, "\t") let [mode, type, sha, size] = split(info, '\s\+') - let s:trees[a:dir][0][filename] = [ftime, mode, type, sha, +size, filename] + let s:trees[a:dir][a:commit][0][filename] = [ftime, mode, type, sha, +size, filename] endfor endif - return s:trees[a:dir] + return s:trees[a:dir][a:commit] endif return [{}, -1] endfunction