Add support for private repositories

Private, non-Enterprise, GitHub repos are hosted on github.com but
use usernames that aren't 'git@...'
This commit is contained in:
John O'Shea
2019-04-23 10:54:40 -06:00
committed by Tim Pope
parent 57a350e632
commit 70713ca031

View File

@@ -30,7 +30,7 @@ function! rhubarb#HomepageForUrl(url) abort
for domain in domains
let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.')
endfor
let base = matchstr(a:url, '^\%(https\=://\|git://\|git@\|ssh://git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$')
let base = matchstr(a:url, '^\%(https\=://\%([^@/:]*@\)\=\|git://\|git@\|ssh://git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$')
if index(domains, 'http://' . matchstr(base, '^[^:/]*')) >= 0
return 'http://' . tr(base, ':', '/')
elseif !empty(base)