From 9f6af8031c1b120826c8dfff71f75381873fb756 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 11 Nov 2009 00:16:02 -0500 Subject: [PATCH] Don't assume buffer().commit() is a hash or stage --- plugin/fugitive.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 4e14f9a..1721e7e 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -388,10 +388,10 @@ function! s:buffer_expand(rev) dict abort endfunction function! s:buffer_containing_commit() dict abort - if self.commit() =~# '\x\{40\}' - return self.commit() - elseif self.commit() =~# '.' + if self.commit() =~# '^\d$' return ':' + elseif self.commit() =~# '.' + return self.commit() else return 'HEAD' endif @@ -888,7 +888,7 @@ function! s:Blame(bang,line1,line2,count) abort endif let git_dir = s:repo().dir() let cmd = ['--no-pager', 'blame', '--show-number'] - if strlen(s:buffer().commit()) == 40 + if s:buffer().commit() =~# '\D\|..' let cmd += [s:buffer().commit()] else let cmd += ['--contents', '-']