Revert "Remove guard against index stage in :Gbrowse handler"

This reverts commit 14daf094d90fe713186881323d41190420bb6319.  My
assertion was wrong; commit will no longer be an index stage but it
still might be an empty string.
This commit is contained in:
Tim Pope 2015-12-26 14:54:35 -05:00
parent 52d180af0a
commit bf04261080

View File

@ -2336,7 +2336,11 @@ function! s:github_url(opts, ...) abort
elseif path =~# '^\.git\>'
return root
endif
let commit = a:opts.commit
if a:opts.commit =~# '^\d\=$'
let commit = a:opts.repo.rev_parse('HEAD')
else
let commit = a:opts.commit
endif
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'