commit a09e49d2bba074a4cc37ed850a556b3604837ff8 (tree)
parent cce9ca09336fcc99efdc7ce5f0fc12eee1412ecc
Author: Tim Pope <code@tpope.net>
Date: Thu, 8 Aug 2019 20:20:45 -0400
Support :Gblame --reverse
Closes https://github.com/tpope/vim-fugitive/issues/1305
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git 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