git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Phillip Wood <phillip.wood123@gmail.com>,
	 git@vger.kernel.org,
	"Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [PATCH v2] unit-tests: do show relative file paths on non-Windows, too
Date: Tue, 13 Feb 2024 12:48:58 -0800	[thread overview]
Message-ID: <xmqqzfw43xad.fsf@gitster.g> (raw)
In-Reply-To: <0fb4e912-b25e-0240-c49f-aac5cbc3ef9e@gmx.de> (Johannes Schindelin's message of "Tue, 13 Feb 2024 20:58:53 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> 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.

      reply	other threads:[~2024-02-13 20:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11  8:57 [PATCH] unit-tests: do show relative file paths on non-Windows, too Junio C Hamano
2024-02-11 11:03 ` Phillip Wood
2024-02-11 15:58   ` [PATCH v2] " Junio C Hamano
2024-02-12 10:44     ` Phillip Wood
2024-02-12 22:41       ` Junio C Hamano
2024-02-13 10:55         ` Phillip Wood
2024-02-13 17:10           ` Junio C Hamano
2024-02-13 19:58     ` Johannes Schindelin
2024-02-13 20:48       ` Junio C Hamano [this message]

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=xmqqzfw43xad.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood123@gmail.com \
    --cc=rsbecker@nexbridge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).