Skip to content

Commit c49a177

Browse files
avargitster
authored andcommitted
test-lib.sh: set COLUMNS=80 for --verbose repeatability
Some tests will fail under --verbose because while we've unset COLUMNS since b1d645b (tests: unset COLUMNS inherited from environment, 2012-03-27), we also look for the columns with an ioctl(.., TIOCGWINSZ, ...) on some platforms. By setting COLUMNS again we preempt the TIOCGWINSZ lookup in pager.c's term_columns(), it'll take COLUMNS over TIOCGWINSZ, This fixes t0500-progress-display.sh., which broke because of a combination of the this issue and the progress output reacting to the column width since 545dc34 (progress: break too long progress bar lines, 2019-04-12). The t5324-split-commit-graph.sh fails in a similar manner due to progress output, see [1] for details. The issue is not specific to progress.c, the diff code also checks COLUMNS and some of its tests can be made to fail in a similar manner[2], anything that invokes a pager is potentially affected. See ea77e67 (Make "git help" react to window size correctly, 2005-12-18) and ad6c373 (pager: find out the terminal width before spawning the pager, 2012-02-12) for how the TIOCGWINSZ code ended up in pager.c 1. http://lore.kernel.org/git/[email protected] 2. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ebf3c04 commit c49a177

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

t/test-lib.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,15 @@ LANG=C
401401
LC_ALL=C
402402
PAGER=cat
403403
TZ=UTC
404-
export LANG LC_ALL PAGER TZ
404+
COLUMNS=80
405+
export LANG LC_ALL PAGER TZ COLUMNS
405406
EDITOR=:
406407

407408
# A call to "unset" with no arguments causes at least Solaris 10
408409
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
409410
# deriving from the command substitution clustered with the other
410411
# ones.
411-
unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
412+
unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
412413
my @env = keys %ENV;
413414
my $ok = join("|", qw(
414415
TRACE

0 commit comments

Comments
 (0)