Always pass commit SHA to :Gbrowse handlers

This commit is contained in:
Tim Pope 2015-12-26 15:09:08 -05:00
parent bf04261080
commit 9ce67cdc93

View File

@ -2215,6 +2215,9 @@ function! s:Browse(bang,line1,count,...) abort
if type ==# 'tree' && !empty(path) if type ==# 'tree' && !empty(path)
let path = s:sub(path, '/\=$', '/') let path = s:sub(path, '/\=$', '/')
endif endif
if empty(commit) && path !~# '^\.git/'
let commit = s:repo().rev_parse('HEAD')
endif
if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1])) if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1]))
let body = readfile(s:repo().dir(path[5:-1]))[0] let body = readfile(s:repo().dir(path[5:-1]))[0]
if body =~# '^\x\{40\}$' if body =~# '^\x\{40\}$'