unit-tests: do show relative file paths on non-Windows, too
commitf66286364f7875f9b3e3ac63733dd98e396fb7b8
authorJunio C Hamano <gitster@pobox.com>
Sun, 11 Feb 2024 15:58:04 +0000 (11 07:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Feb 2024 16:44:22 +0000 (12 08:44 -0800)
tree954d041626814d2a21e4d9184fff852e881a2a1d
parenta2c5e294dbb095023e6c0d53b302c4363021f1b2
unit-tests: do show relative file paths on non-Windows, too

There are compilers other than Visual C that want to show absolute
paths.  Generalize the helper introduced by a2c5e294 (unit-tests: do
show relative file paths, 2023-09-25) so that it can also work with
a path that uses slash as the directory separator, and becomes
almost no-op once one-time preparation finds out that we are using a
compiler that already gives relative paths.  Incidentally, this also
should do the right thing on Windows with a compiler that shows
relative paths but with backslash as the directory separator (if
such a thing exists and is used to build git).

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/test-lib.c