mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 14:23:51 -05:00
Improve :Gclog window title
This commit is contained in:
@@ -3953,32 +3953,36 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
|
||||
endif
|
||||
if a:line1 == 0 && a:count
|
||||
let path = fugitive#Path(bufname(a:count), '/', dir)
|
||||
let titlepre = ':0,' . a:count
|
||||
elseif a:count >= 0
|
||||
let path = fugitive#Path(@%, '/', dir)
|
||||
let titlepre = a:count == 0 ? ':0,' . bufnr('') : ':'
|
||||
else
|
||||
let path = ''
|
||||
let titlepre = ':'
|
||||
let path = ''
|
||||
endif
|
||||
let range = ''
|
||||
let extra = []
|
||||
let extra_args = []
|
||||
let extra_paths = []
|
||||
let state = {'context': 'init', 'child_found': 0, 'queue': [], 'follow': 0}
|
||||
if path =~# '^/\.git\%(/\|$\)\|^$'
|
||||
let path = ''
|
||||
elseif a:line1 == 0
|
||||
let range = "0," . (a:count ? a:count : bufnr(''))
|
||||
let extra = ['.' . path]
|
||||
let extra_paths = ['.' . path]
|
||||
if (empty(paths) || paths ==# ['--']) && !s:HasOpt(args, '--no-follow')
|
||||
let state.follow = 1
|
||||
if !s:HasOpt(args, '--follow')
|
||||
call insert(args, '--follow')
|
||||
call insert(extra_args, '--follow')
|
||||
endif
|
||||
if !s:HasOpt(args, '--summary')
|
||||
call insert(args, '--summary')
|
||||
call insert(extra_args, '--summary')
|
||||
let state.ignore_summary = 1
|
||||
endif
|
||||
endif
|
||||
elseif a:count > 0
|
||||
if !s:HasOpt(args, '--merges', '--no-merges')
|
||||
call insert(args, '--no-merges')
|
||||
call insert(extra_args, '--no-merges')
|
||||
endif
|
||||
call add(args, '-L' . a:line1 . ',' . a:count . ':' . path[1:-1])
|
||||
endif
|
||||
@@ -3988,7 +3992,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
|
||||
call add(args, owner)
|
||||
endif
|
||||
endif
|
||||
if empty(extra)
|
||||
if empty(extra_paths)
|
||||
let path = ''
|
||||
endif
|
||||
if s:HasOpt(args, '-g', '--walk-reflogs')
|
||||
@@ -4004,10 +4008,10 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
|
||||
endif
|
||||
call extend(cmd,
|
||||
\ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] +
|
||||
\ args + paths + extra)
|
||||
\ args + extra_args + paths + extra_paths)
|
||||
let state.target = path
|
||||
let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths)
|
||||
if empty(paths + extra) && empty(a:type) && len(s:Relative('/'))
|
||||
let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths)
|
||||
if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/'))
|
||||
let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after
|
||||
endif
|
||||
return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after
|
||||
|
||||
Reference in New Issue
Block a user