diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index e703693..bb429ad 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4615,18 +4615,19 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) if empty(s:Relative('/')) call s:throw('file or blob required') endif + let commit = matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$') if filter(copy(a:args),'v:val !~# "^-"') != [] call s:throw("'-' required for all options") - elseif filter(copy(a:args),'v:val !~# "^\\%(--abbrev=\\d*\\|--relative-date\\|--first-parent\\|--root\\|--show-name\\|-\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] - call s:throw('unsupported option') + elseif filter(copy(a:args),'v:val !~# "^\\%(--abbrev=\\d*\\|--relative-date\\|--first-parent\\|--root\\|--show-name' . (len(commit) ? '\\|--reverse' : '') . '\\|-\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] + call s:throw('unsupported option' . commit) endif let cmd = ['--no-pager', '-c', 'blame.coloring=none', 'blame', '--show-number'] if a:count > 0 let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))] endif let cmd += a:args - if s:DirCommitFile(@%)[1] =~# '\D\|..' - let cmd += [s:DirCommitFile(@%)[1]] + if len(commit) + let cmd += [commit] else let cmd += ['--contents', '-'] endif