diff options
| author | brian m. carlson <sandals@crustytoothpaste.net> | 2025-11-28 01:21:05 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-27 19:06:01 -0800 |
| commit | bf25fca31c5a923598ce8461034a992920e3625b (patch) | |
| tree | 0ba9fc62e56c696bc9c66023fa1187e6b45fe44c /diff-lib.c | |
| parent | 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed (diff) | |
| download | git-bf25fca31c5a923598ce8461034a992920e3625b.tar.gz | |
t0614: use numerical comparison with test_line_count
In this comparison, we want to know whether the number of lines is
greater than 1. Our test_line_count function passes the first argument
as the comparison operator to test, so what we want is a numerical
comparison, not a string comparison. While this does not produce a
functional problem now, it could very well if we expected two or more
items, in which case the value "10" would not match when it should.
Furthermore, the "<" and ">" comparisons are new in POSIX 1003.1-2024
and we don't want to require such a new version of POSIX since many
popular and supported operating systems were released before that
version of POSIX was released.
Finally, zsh's builtin test operator does not like the greater-than sign
in "test", since it is only supported in the double-bracket extension.
This has been reported and will be addressed in a future version, but
since our code is also technically incorrect, as well as not very
compatible, let's fix it by using a numeric comparison.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
0 files changed, 0 insertions, 0 deletions
