Wes
Wes

Reputation: 487

core.pager for all output from git

Is it possible to use core.pager for all output from git?

E.g.

git branch -av

Should not wrap lines in my terminal.

git log already has paging as expected with less.

I'd rather not have to pipe the output of each command to less to get this functionality.

I'm using bash 4.3.18(1)-release on OS X (10.9.5) with iTerm2 2.0 and xterm-256color.

Upvotes: 2

Views: 317

Answers (1)

VonC
VonC

Reputation: 1324447

Git 2.16 (Q1 2018) will be able to help, considering "git branch --list" learned to show its output through the pager by default when the output is going to a terminal, which is controlled by the pager.branch configuration variable.
This is similar to a recent change to "git tag --list" (Git 2.14.2, Sept. 2017).

See commit 0ae19de, commit d74b541, commit ed104fa (19 Nov 2017) by Martin Ågren (``).
(Merged by Junio C Hamano -- gitster -- in commit 3b49e1b, 28 Nov 2017)

branch: respect pager.branch in list-mode only

Similar to de121ff (tag: respect pager.tag in list-mode only, 2017-08-02), use the DELAY_PAGER_CONFIG-mechanism to only respect pager.branch when we are listing branches.

We have two possibilities of generalizing what that earlier commit made to git tag.

  • One is to interpret, e.g., --set-upstream-to as "it does not use an editor, so we should page".
  • Another, the one taken by this commit, is to say "it does not list, so let's not page". That is in line with the approach of the series on pager.tag and in particular the wording in Documentation/git-tag.txt, which this commit reuses for git-branch.txt.

This fixes the failing test added in the previous commit. Also adapt the test for whether git branch --set-upstream-to respects pager.branch.

Upvotes: 1

Related Questions