Skip to content

Commit e18b1df

Browse files
committed
Merge branch 'kd/auto-col-with-pager-fix' into maint
"auto" as a value for the columnar output configuration ought to judge "is the output consumed by humans?" with the same criteria as "auto" for coloured output configuration, i.e. either the standard output stream is going to tty, or a pager is in use. We forgot the latter, which has been fixed. * kd/auto-col-with-pager-fix: column: do not include pager.c column: show auto columns when pager is active
2 parents 2cd4e03 + 965ff23 commit e18b1df

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

column.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ int finalize_colopts(unsigned int *colopts, int stdout_is_tty)
224224
if (stdout_is_tty < 0)
225225
stdout_is_tty = isatty(1);
226226
*colopts &= ~COL_ENABLE_MASK;
227-
if (stdout_is_tty)
227+
if (stdout_is_tty || pager_in_use())
228228
*colopts |= COL_ENABLED;
229229
}
230230
return 0;

t/t7006-pager.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,4 +570,18 @@ test_expect_success 'command with underscores does not complain' '
570570
test_cmp expect actual
571571
'
572572

573+
test_expect_success TTY 'git tag with auto-columns ' '
574+
test_commit one &&
575+
test_commit two &&
576+
test_commit three &&
577+
test_commit four &&
578+
test_commit five &&
579+
cat >expect <<-\EOF &&
580+
initial one two three four five
581+
EOF
582+
test_terminal env PAGER="cat >actual" COLUMNS=80 \
583+
git -c column.ui=auto tag --sort=authordate &&
584+
test_cmp expect actual
585+
'
586+
573587
test_done

0 commit comments

Comments
 (0)