From bf042610806a35c9a7fb2eb705734c7ef3be33d0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 26 Dec 2015 14:54:35 -0500 Subject: [PATCH] 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. --- plugin/fugitive.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 9ab22f6..0452956 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -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 =~# '[^/]$'