Skip to content

Commit 2341ee3

Browse files
authored
Support git remotes with explicit port numbers (#6)
1 parent 545210f commit 2341ee3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autoload/phabricator.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ function! s:diffusion_root_for_remote(url) abort
3939
for host in hosts
4040
let host_pattern .= '\|' . escape(split(host, '://')[-1], '.')
4141
endfor
42-
let base = matchstr(a:url, '^\%(https\=://\|git://\|git@\|ssh://code@\|ssh://git@\)\=\zs\('.host_pattern.'\)\/diffusion[/:][^/]\{-\}\ze[/:].\{-\}\%(\.git\)\=$')
42+
let base = matchstr(a:url, '^\%(https\=://\|git://\|git@\|ssh://code@\|ssh://git@\)\=\zs\('.host_pattern.'\)\%(:\d\{1,5}\)\=\/diffusion[/:][^/]\{-\}\ze[/:].\{-\}\%(\.git\)\=$')
4343
if !empty(base)
44+
" Remove the port component of the hostname.
45+
let base = substitute(base, '[^/]*\zs:\d\{1,5}', '', '')
4446
return 'https://' . tr(base, ':', '/')
4547
endif
4648
return ''

0 commit comments

Comments
 (0)