All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] test-lib.sh: set COLUMNS=80 for --verbose repeatability
Date: Thu, 24 Jun 2021 12:19:31 +0200	[thread overview]
Message-ID: <patch-1.1-765c2793122-20210624T101839Z-avarab@gmail.com> (raw)
In-Reply-To: <patch-1.1-cba5d88ca35-20210621T070114Z-avarab@gmail.com>

Some tests will fail under --verbose because while we've unset COLUMNS
since b1d645b58ac (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 the t0500-progress-display.sh test when run as:

    ./t0500-progress-display.sh --verbose

It broke because of a combination of the this issue and the progress
output reacting to the column width since 545dc345ebd (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.

A more narrow fix here would be to only do this in the --verbose mode,
but there's no harm in setting this for everything. If we're not
connected to a TTY the COLUMNS setting won't matter.

See ea77e675e56 (Make "git help" react to window size correctly,
2005-12-18) and ad6c3739a33 (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/20210624051253.GG6312@szeder.dev

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

This replaces a more narrow fix in
https://lore.kernel.org/git/patch-1.1-cba5d88ca35-20210621T070114Z-avarab@gmail.com/,
which as SZEDER points out was also needed by another test using the
progress.c code.

 t/test-lib.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 54938c64279..1a6ca772d6c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -406,14 +406,15 @@ LANG=C
 LC_ALL=C
 PAGER=cat
 TZ=UTC
-export LANG LC_ALL PAGER TZ
+COLUMNS=80
+export LANG LC_ALL PAGER TZ COLUMNS
 EDITOR=:
 
 # A call to "unset" with no arguments causes at least Solaris 10
 # /usr/xpg4/bin/sh and /bin/ksh to bail out.  So keep the unsets
 # deriving from the command substitution clustered with the other
 # ones.
-unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
+unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
 	my @env = keys %ENV;
 	my $ok = join("|", qw(
 		TRACE
-- 
2.32.0.605.g06ef811e153


  parent reply	other threads:[~2021-06-24 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  7:01 [PATCH] progress.c tests: fix breakage with COLUMNS != 80 Ævar Arnfjörð Bjarmason
2021-06-23 23:48 ` Jeff King
2021-06-24  5:12   ` SZEDER Gábor
2021-06-24  5:40     ` Jeff King
2021-06-24 15:05   ` Philip Oakley
2021-06-24 10:19 ` Ævar Arnfjörð Bjarmason [this message]
2021-06-24 14:50   ` [PATCH] test-lib.sh: set COLUMNS=80 for --verbose repeatability Jeff King
2021-06-27  7:44   ` SZEDER Gábor
2021-06-29  1:42     ` Junio C Hamano
2021-06-29 11:29   ` [PATCH v2] " Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-1.1-765c2793122-20210624T101839Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.