git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] branch: change default of `pager.branch` to "on"

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Nov 19, 2017, 15:03 UTC
Message-ID
<ef9b1f9e3cd70bdf3500a242781f9ba030bbf8aa.1511103275.git.martin.agren@gmail.com>
In-Reply-To
<5f6be626171060e008005062560c76319b31958f.1511103275.git.martin.agren@gmail.com>

This is similar to ff1e72483 (tag: change default of `pager.tag` to "on", 2017-08-02) and is safe now that we do not consider `pager.branch` at all when we are not listing branches. This change will help with listing many branches, but will not hurt users of `git branch --edit-description` as it would have before the previous commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 Documentation/git-branch.txt |  2 +-
 t/t7006-pager.sh             | 10 +++++-----
 builtin/branch.c             |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index df24506e18..520c53b5e8 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -284,7 +284,7 @@ start-point is either a local or remote-tracking branch.
 CONFIGURATION
 -------------
 `pager.branch` is only respected when listing branches, i.e., when
-`--list` is used or implied.
+`--list` is used or implied. The default is to use a pager.
 See linkgit:git-config[1].
 
 Examples
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index bb4fee3901..f5f46a95b4 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -214,21 +214,21 @@ test_expect_success TTY 'git tag as alias respects pager.tag with -l' '
 	! test -e paginated.out
 '
 
-test_expect_success TTY 'git branch defaults to not paging' '
+test_expect_success TTY 'git branch defaults to paging' '
 	rm -f paginated.out &&
 	test_terminal git branch &&
-	! test -e paginated.out
+	test -e paginated.out
 '
 
 test_expect_success TTY 'git branch respects pager.branch' '
 	rm -f paginated.out &&
-	test_terminal git -c pager.branch branch &&
-	test -e paginated.out
+	test_terminal git -c pager.branch=false branch &&
+	! test -e paginated.out
 '
 
 test_expect_success TTY 'git branch respects --no-pager' '
 	rm -f paginated.out &&
-	test_terminal git -c pager.branch --no-pager branch &&
+	test_terminal git --no-pager branch &&
 	! test -e paginated.out
 '
 
diff --git a/builtin/branch.c b/builtin/branch.c
index 9c74689fb0..4e6b8c3bc1 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -676,7 +676,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 	}
 
 	if (list)
-		setup_auto_pager("branch", 0);
+		setup_auto_pager("branch", 1);
 
 	if (delete) {
 		if (!argc)
-- 
2.15.0.415.gac1375d7e
Previous: Martin Ågren
Message 3 of 3 in “t7006: add tests for how git branch paginates”
  1. 1/3 t7006: add tests for how git branch paginatesMartin Ågren, Nov 19, 2017
  2. 2/3 branch: respect `pager.branch` in list-mode onlyMartin Ågren, Nov 19, 2017
  3. 3/3 branch: change default of `pager.branch` to "on"Martin Ågren, Nov 19, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.