summaryrefslogtreecommitdiff
path: root/builtin/column.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-05-11 09:25:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-13 01:45:03 (GMT)
commitbe11f7ad60fb9e114891db993830e57fef9989ea (patch)
tree06c9b3f5f313ce2a6deaca845d6a314c453ca4d5 /builtin/column.c
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
downloadgit-be11f7ad60fb9e114891db993830e57fef9989ea.zip
git-be11f7ad60fb9e114891db993830e57fef9989ea.tar.gz
git-be11f7ad60fb9e114891db993830e57fef9989ea.tar.bz2
pager: set COLUMNS to term_columns()
After we invoke the pager, our stdout goes to a pipe, not the terminal, meaning we can no longer use an ioctl to get the terminal width. For that reason, ad6c3739a3 (pager: find out the terminal width before spawning the pager, 2012-02-12) started caching the terminal width. But that cache is only an in-process variable. Any programs we spawn will also not be able to run that ioctl, but won't have access to our cache. They'll end up falling back to our 80-column default. You can see the problem with: git tag --column=row Since git-tag spawns a pager these days, its spawned git-column helper will see neither the terminal on stdout nor a useful COLUMNS value (assuming you do not export it from your shell already). And you'll end up with 80-column output in the pager, regardless of your terminal size. We can fix this by setting COLUMNS right before spawning the pager. That fixes this case, as well as any more complicated ones (e.g., a paged program spawns another script which then generates columnized output). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/column.c')
0 files changed, 0 insertions, 0 deletions