Fix file API to distinguish between commits
This commit is contained in:
parent
8c63314381
commit
a3e9518186
@ -588,23 +588,26 @@ function! s:TreeInfo(dir, commit) abort
|
|||||||
return [get(s:indexes[a:dir][1], a:commit[-1:-1], {}), newftime]
|
return [get(s:indexes[a:dir][1], a:commit[-1:-1], {}), newftime]
|
||||||
elseif a:commit =~# '^\x\{40\}$'
|
elseif a:commit =~# '^\x\{40\}$'
|
||||||
if !has_key(s:trees, a:dir)
|
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)
|
let ftime = +system(git . ' log -1 --pretty=format:%ct ' . a:commit)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
let s:trees[a:dir] = [{}, -1]
|
let s:trees[a:dir][a:commit] = [{}, -1]
|
||||||
return s:trees[a:dir]
|
return s:trees[a:dir][a:commit]
|
||||||
endif
|
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)
|
let out = system(git . ' ls-tree -rtl --full-name ' . a:commit)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
return s:trees[a:dir]
|
return s:trees[a:dir][a:commit]
|
||||||
endif
|
endif
|
||||||
for line in split(out, "\n")
|
for line in split(out, "\n")
|
||||||
let [info, filename] = split(line, "\t")
|
let [info, filename] = split(line, "\t")
|
||||||
let [mode, type, sha, size] = split(info, '\s\+')
|
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
|
endfor
|
||||||
endif
|
endif
|
||||||
return s:trees[a:dir]
|
return s:trees[a:dir][a:commit]
|
||||||
endif
|
endif
|
||||||
return [{}, -1]
|
return [{}, -1]
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user