summaryrefslogtreecommitdiff
path: root/t/t7006-pager.sh
diff options
context:
space:
mode:
authorKevin Daudt <me@ikke.info>2017-10-16 18:35:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-17 03:16:45 (GMT)
commitb2d3fd287b60aae963d683f89f24dc6cb97520f8 (patch)
tree6251ba6ac1951e7d1a6501b905be693a265dda31 /t/t7006-pager.sh
parentff1e72483f416ecb58737205163031f54c24e754 (diff)
downloadgit-b2d3fd287b60aae963d683f89f24dc6cb97520f8.zip
git-b2d3fd287b60aae963d683f89f24dc6cb97520f8.tar.gz
git-b2d3fd287b60aae963d683f89f24dc6cb97520f8.tar.bz2
column: show auto columns when pager is active
When columns are set to automatic for git tag and the output is paginated by git, the output is a single column instead of multiple columns. Standard behaviour in git is to honor auto values when the pager is active, which happens for example with commands like git log showing colors when being paged. Since ff1e72483 (tag: change default of `pager.tag` to "on", 2017-08-02), the pager has been enabled by default, exposing this problem to more people. finalize_colopts in column.c only checks whether the output is a TTY to determine if columns should be enabled with columns set to auto. Also check if the pager is active. Adding a test for git column is possible but requires some care to work around a race on stdin. See commit 18d8c2693 (test_terminal: redirect child process' stdin to a pty, 2015-08-04). Test git tag instead, since that does not involve stdin, and since that was the original motivation for this patch. Helped-by: Rafael Ascensão <rafa.almas@gmail.com> Signed-off-by: Kevin Daudt <me@ikke.info> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7006-pager.sh')
-rwxr-xr-xt/t7006-pager.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index afa03f3..f630fe0 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -570,4 +570,18 @@ test_expect_success 'command with underscores does not complain' '
test_cmp expect actual
'
+test_expect_success TTY 'git tag with auto-columns ' '
+ test_commit one &&
+ test_commit two &&
+ test_commit three &&
+ test_commit four &&
+ test_commit five &&
+ cat >expect <<-\EOF &&
+ initial one two three four five
+ EOF
+ test_terminal env PAGER="cat >actual" COLUMNS=80 \
+ git -c column.ui=auto tag --sort=authordate &&
+ test_cmp expect actual
+'
+
test_done