diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-06-21 16:57:58 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-06-28 10:42:10 -0700 |
commit | 9b6e2c8b98f6a382a6ee8d9110bfe93b1b48d6a7 (patch) | |
tree | c7f057b0eb0a8ce80746a1acf4e4e51e608388be /t/t5411/test-0011-no-hook-error.sh | |
parent | Git 2.32 (diff) | |
download | tgif-9b6e2c8b98f6a382a6ee8d9110bfe93b1b48d6a7.tar.xz |
pager: avoid setting COLUMNS when we're guessing its value
We query `TIOCGWINSZ` in Git to determine the correct value for
`COLUMNS`, and then set that environment variable.
If `TIOCGWINSZ` is not available, we fall back to the hard-coded value
80 _and still_ set the environment variable.
On Windows this is a problem. The reason is that Git for
Windows uses a version of `less` that relies on the MSYS2 runtime to
interact with the pseudo terminal (typically inside a MinTTY window,
which is also aware of the MSYS2 runtime). Both MinTTY and `less.exe`
interact with that pseudo terminal via `ioctl()` calls (which the MSYS2
runtime emulates even if there is no such thing on Windows).
Since https://github.com/gwsw/less/commit/bb0ee4e76c2, `less` prefers
the `COLUMNS` variable over asking ncurses itself.
But `git.exe` itself is _not_ aware of the MSYS2 runtime, or for that
matter of that pseudo terminal, and has no way to call `ioctl()` or
`TIOCGWINSZ`.
Therefore, `git.exe` will fall back to hard-coding 80 columns, no matter
what the actual terminal size is.
But `less.exe` is totally able to interact with the MSYS2 runtime and
would not actually require Git's help (which actually makes things
worse here). So let's not override `COLUMNS` on Windows.
Let's just not set `COLUMNS` unless we managed to query the actual value
from the terminal.
This fixes https://github.com/git-for-windows/git/issues/3235
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5411/test-0011-no-hook-error.sh')
0 files changed, 0 insertions, 0 deletions