From ff32149a59f9ba6d1b8067e39cc823c99178cb29 Mon Sep 17 00:00:00 2001 From: Tim Pope <code@tpope.net> Date: Sun, 18 Nov 2012 21:35:37 -0500 Subject: [PATCH] Attempt to allow :Gbrowse on HTTP GitHub FI --- plugin/fugitive.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 41477f1b..67b3bf5b 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1870,14 +1870,19 @@ endfunction function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort let path = a:path let domain_pattern = 'github\.com' - for domain in exists('g:fugitive_github_domains') ? g:fugitive_github_domains : [] - let domain_pattern .= '\|' . escape(domain, '.') + let domains = exists('g:fugitive_github_domains') ? g:fugitive_github_domains : [] + for domain in domains + let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.') endfor let repo = matchstr(a:url,'^\%(https\=://\|git://\|git@\)\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$') if repo ==# '' return '' endif - let root = 'https://' . s:sub(repo,':','/') + if index(g:fugitive_github_domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0 + let root = 'http://' . s:sub(repo,':','/') + else + let root = 'https://' . s:sub(repo,':','/') + endif if path =~# '^\.git/refs/heads/' let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1] if branch ==# '' -- GitLab