Refine handling of pagination via temp buffer

Use temp buffer for output of any command for which the Git
configuration option of pager.<command> is true.  Avoid using a temp
buffer if the value is false, even for commands like "show" where we
normally would.  If the configuration value is present and can't be
interpreted as a Boolean, punt to a :terminal where Git will invoke it
directly.

Generate and use custom config dictionary that includes -c values passed
to :Git.  This enables `:Git -c pager.status status` to correctly use a
pager.

Paginate "config", "branch", and "tag" for certain argument lists,
matching the logic found in the Git source code as closely as possible.
These 3 commands were identified as having special pagination logic by
the presence of the DELAY_PAGER_CONFIG flag on their definitions in
git.c.

Paginate "am --show-current-patch".

References https://github.com/tpope/vim-fugitive/issues/1415
This commit is contained in:
Tim Pope
2020-02-18 19:44:49 -05:00
parent a81ba999e8
commit 2e67f82b79
2 changed files with 58 additions and 13 deletions

View File

@@ -25,10 +25,12 @@ that are part of Git repositories).
resume running the command. A few Git subcommands
have different behavior; these are documented below.
:Git! {args} Run an arbitrary git command, capture output to a temp
:Git --paginate {args} file, and |:split| that temp file. Use :0Git to
:Git -p {args} |:edit| the temp file instead. A temp file is always
:G ... used for diff and log commands.
:Git --paginate {args} Run an arbitrary git command, capture output to a temp
:Git -p {args} file, and |:split| that temp file. Use :0Git to
:G --paginate {args} |:edit| the temp file instead. A temp file is always
:G -p {args} used for commands like diff and log that typically
user a pager, and for any command that has the
pager.<cmd> Git configuration option set.
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
@@ -630,6 +632,7 @@ just one space character longer than the legacy version.
*:Gfetch* Superseded by |:Git-fetch|.
*:Glog* Superseded by |:Gclog|.
*:Gstatus* Superseded by |:Git| (with no arguments).
*:Git!* Superseded by |:Git| --paginate.
*:Gsplit!* Superseded by |:Git| --paginate.
*:Gvsplit!* Superseded by |:vert| |:Git| --paginate.
*:Gtabsplit!* Superseded by |:tab| |:Git| --paginate.