From c6c6f4bbf3086d37c658e13aabbea8e2db5a0070 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 1 Dec 2015 19:03:49 -0500 Subject: [PATCH] Future proofing --- autoload/rhubarb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/rhubarb.vim b/autoload/rhubarb.vim index c7dc642..65c547c 100644 --- a/autoload/rhubarb.vim +++ b/autoload/rhubarb.vim @@ -191,7 +191,7 @@ function! rhubarb#fugitive_url(opts, ...) abort if empty(root) return '' endif - let path = a:opts.path + let path = substitute(a:opts.path, '^/', '', '') if path =~# '^\.git/refs/heads/' let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1] if branch ==# '' @@ -219,7 +219,7 @@ function! rhubarb#fugitive_url(opts, ...) abort else let commit = a:opts.commit endif - if a:opts.type == 'tree' + if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$' let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g') elseif a:opts.type == 'blob' let url = root . '/blob/' . commit . '/' . path