motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit c21736dde74300fa81eda011d37eaa060a2df4e9 (tree)
parent 11691b38bb2a3a806f373b8f35da207725dc22dc
Author: Tim Pope <code@tpope.net>
Date:   Tue, 13 Aug 2019 20:31:16 -0400

Jump to file not diff for boundary commit in :Gblame

Diffstat:
Mautoload/fugitive.vim | 19+++++++++++++++----
Mdoc/fugitive.txt | 12+++++++-----
2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -4596,7 +4596,7 @@ function! s:BlameCommitFileLnum(...) abort if commit =~# '^0\+$' let commit = '' elseif line !~# '^\^' && has_key(state, 'blame_reverse_end') - let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, commit) + let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '') endif let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)') let path = matchstr(line, '^\^\=\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s\+\%(\%( \d\+ \)\@<!([^()]*\w \d\+)\|\d\+ \)') @@ -4833,12 +4833,23 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort endfunction function! s:BlameCommit(cmd, ...) abort - let [commit, path, lnum] = call('s:BlameCommitFileLnum', a:000) + let line = a:0 ? a:1 : getline('.') + let state = a:0 ? a:2 : s:TempState() + let sigil = has_key(state, 'blame_reverse_end') ? '-' : '+' + let mods = (s:BlameBufnr() < 0 ? '' : &splitbelow ? "botright " : "topleft ") + let [commit, path, lnum] = s:BlameCommitFileLnum(line, state) + if empty(commit) && len(path) && has_key(state, 'blame_reverse_end') + let path = (len(state.blame_reverse_end) ? state.blame_reverse_end . ':' : ':(top)') . path + return s:Open(mods . a:cmd, 0, '', '+' . lnum . ' ' . s:fnameescape(path), ['+' . lnum, path]) + endif if commit =~# '^0*$' return 'echoerr ' . string('fugitive: no commit') endif - let sigil = has_key(a:0 ? a:2 : s:TempState(), 'blame_reverse_end') ? '-' : '+' - let cmd = s:Open((s:BlameBufnr() < 0 ? '' : &splitbelow ? "botright " : "topleft ") . a:cmd, 0, '', commit, [commit]) + if line =~# '^\^' && !has_key(state, 'blame_reverse_end') + let path = commit . ':' . path + return s:Open(mods . a:cmd, 0, '', '+' . lnum . ' ' . s:fnameescape(path), ['+' . lnum, path]) + endif + let cmd = s:Open(mods . a:cmd, 0, '', commit, [commit]) if cmd =~# '^echoerr' return cmd endif diff --git a/doc/fugitive.txt b/doc/fugitive.txt @@ -199,11 +199,13 @@ that are part of Git repositories). A resize to end of author column C resize to end of commit column D resize to end of date/time column - gq close blame, then |:Gedit| to return to work tree version - <CR> close blame, then open commit - o open commit in horizontal split - O open commit in new tab - p open commit in preview window + gq close blame, then |:Gedit| to return to work + tree version + <CR> close blame, and jump to patch that added line + (or directly to blob for boundary commit) + o jump to patch or blob in horizontal split + O jump to patch or blob in new tab + p jump to patch or blob in preview window - reblame at commit ~ reblame at [count]th first grandparent P reblame at [count]th parent (like HEAD^[count])