Change :Git --paginate from :terminal to temp buffer

The --paginate option to Git forces it to use $PAGER rather than its own
configuration, so it makes perfect sense for Fugitive to take on the
role of the pager.

This also removes the same behavior for --no-pager, allowing the command
to run with :! instead.  I really don't like sudden backwards
incompatible changes like this, but the old behavior was based on a bad
understanding of how these options work, and I'd rather rip the band-aid
off sooner rather than later.
This commit is contained in:
Tim Pope
2020-01-20 06:20:12 -05:00
parent bc0b78ee84
commit 2ebdeef9e0
2 changed files with 7 additions and 10 deletions

View File

@@ -2182,18 +2182,16 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
else
let opts = {}
endif
if a:bang || args[0] =~# '^-P$\|^--no-pager$\|diff\%(tool\)\@!\|log\|^show$' ||
if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' ||
\ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') ||
\ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web')
if args[0] =~# '^-p$\|^--paginate$'
call remove(args, 0)
endif
return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after
endif
if index(['--paginate', '-p'], args[0]) >= 0
let paginate_warning = 'fugitive: --paginate support is deprecated. Use :terminal directly'
let after = '|echohl WarningMsg|echo ' . string(paginate_warning) . '|echohl NONE' . after
endif
if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') ||
\ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') ||
\ index(['--paginate', '-p'], args[0]) >= 0
\ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive')
let mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g')
let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : ''
if has('nvim')

View File

@@ -20,10 +20,9 @@ that are part of Git repositories).
:G {args} but chdir to the repository tree first. For some
subcommands, a Fugitive command is called instead.
*:Git!*
:Git! {args} Like |:Git|, but capture the output into a temp file,
:Git --no-pager {args} and |:split| that temp file. Use :0Git to
:Git -P {args} |:edit| the temp file instead. A temp file is always
:Git --paginate {args} and |:split| that temp file. Use :0Git to
:Git -p {args} |:edit| the temp file instead. A temp file is always
used for diff and log commands.
*:Gstatus*