summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-branch.txt6
-rw-r--r--builtin/branch.c3
-rw-r--r--git.c2
-rwxr-xr-xt/t7006-pager.sh6
4 files changed, 13 insertions, 4 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 81bd0a7b77..9dae1ea295 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -271,6 +271,12 @@ start-point is either a local or remote-tracking branch.
pointed at by a ref being shown. The format is the same as
that of linkgit:git-for-each-ref[1].
+CONFIGURATION
+-------------
+`pager.branch` is only respected when listing branches, i.e., when
+`--list` is used or implied.
+See linkgit:git-config[1].
+
Examples
--------
diff --git a/builtin/branch.c b/builtin/branch.c
index 8a0595e115..3eb31cd1ed 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -648,6 +648,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
rename *= 2;
}
+ if (list)
+ setup_auto_pager("branch", 0);
+
if (delete) {
if (!argc)
die(_("branch name required"));
diff --git a/git.c b/git.c
index 6b6d9f68e1..df66b8b2e0 100644
--- a/git.c
+++ b/git.c
@@ -368,7 +368,7 @@ static struct cmd_struct commands[] = {
{ "archive", cmd_archive, RUN_SETUP_GENTLY },
{ "bisect--helper", cmd_bisect__helper, RUN_SETUP },
{ "blame", cmd_blame, RUN_SETUP },
- { "branch", cmd_branch, RUN_SETUP },
+ { "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG },
{ "bundle", cmd_bundle, RUN_SETUP_GENTLY },
{ "cat-file", cmd_cat_file, RUN_SETUP },
{ "check-attr", cmd_check_attr, RUN_SETUP },
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 12c72ef967..5998f7135b 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -232,7 +232,7 @@ test_expect_success TTY 'git branch respects --no-pager' '
! test -e paginated.out
'
-test_expect_failure TTY 'git branch --edit-description ignores pager.branch' '
+test_expect_success TTY 'git branch --edit-description ignores pager.branch' '
rm -f paginated.out editor.used &&
write_script editor <<-\EOF &&
echo "New description" >"$1"
@@ -243,13 +243,13 @@ test_expect_failure TTY 'git branch --edit-description ignores pager.branch' '
test -e editor.used
'
-test_expect_success TTY 'git branch --set-upstream-to respects pager.branch' '
+test_expect_success TTY 'git branch --set-upstream-to ignores pager.branch' '
rm -f paginated.out &&
git branch other &&
test_when_finished "git branch -D other" &&
test_terminal git -c pager.branch branch --set-upstream-to=other &&
test_when_finished "git branch --unset-upstream" &&
- test -e paginated.out
+ ! test -e paginated.out
'
# A colored commit log will begin with an appropriate ANSI escape