From: Junio C Hamano Date: Tue, 13 Feb 2024 20:48:58 GMT Subject: Re: [PATCH v2] unit-tests: do show relative file paths on non-Windows, too Message-ID: In-Reply-To: <0fb4e912-b25e-0240-c49f-aac5cbc3ef9e@gmx.de> Johannes Schindelin writes: >> + /* >> + * The path could be relative (t/unit-tests/test-lib.c) >> + * or full (/home/user/git/t/unit-tests/test-lib.c). >> + * Check the slash between "t" and "unit-tests". >> + */ >> + prefix_len = len - needle_len; >> + if (prefix[prefix_len + 1] == '/') { >> + /* Oh, we're not Windows */ >> + for (size_t i = 0; i < needle_len; i++) >> + if (needle[i] == '\\') >> + needle[i] = '/'; > > This looks very similar to the `convert_slashes()` function that is > defined in `compat/mingw.h`. I lifted it from your later loop in the function, but given that many of the things that needed on Windows came from you, it is not surprising if you have another copy there ;-) > It might be a good opportunity to rename that > function and move it to `git-compat-util.h`, then use it here and once > more below at the end of `make_relative()`. Right. But not as part of the -rc fix. Let's leave it as #leftoverbits. Thanks.