Support :Gblame --reverse
Closes https://github.com/tpope/vim-fugitive/issues/1305
This commit is contained in:
parent
cce9ca0933
commit
a09e49d2bb
@ -4615,18 +4615,19 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
if empty(s:Relative('/'))
|
if empty(s:Relative('/'))
|
||||||
call s:throw('file or blob required')
|
call s:throw('file or blob required')
|
||||||
endif
|
endif
|
||||||
|
let commit = matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$')
|
||||||
if filter(copy(a:args),'v:val !~# "^-"') != []
|
if filter(copy(a:args),'v:val !~# "^-"') != []
|
||||||
call s:throw("'-' required for all options")
|
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*\\)\\+\\)$"') != []
|
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')
|
call s:throw('unsupported option' . commit)
|
||||||
endif
|
endif
|
||||||
let cmd = ['--no-pager', '-c', 'blame.coloring=none', 'blame', '--show-number']
|
let cmd = ['--no-pager', '-c', 'blame.coloring=none', 'blame', '--show-number']
|
||||||
if a:count > 0
|
if a:count > 0
|
||||||
let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))]
|
let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))]
|
||||||
endif
|
endif
|
||||||
let cmd += a:args
|
let cmd += a:args
|
||||||
if s:DirCommitFile(@%)[1] =~# '\D\|..'
|
if len(commit)
|
||||||
let cmd += [s:DirCommitFile(@%)[1]]
|
let cmd += [commit]
|
||||||
else
|
else
|
||||||
let cmd += ['--contents', '-']
|
let cmd += ['--contents', '-']
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user