All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: Rodrigo Michelassi <rodmichelassi@gmail.com>,
	 git@vger.kernel.org, icaselli@usp.br
Subject: Re: [PATCH] replace 'test -[efd]' with 'test_path_is_[file,dir,executable]'
Date: Sun, 15 Jun 2025 21:16:24 -0700	[thread overview]
Message-ID: <xmqqwm9c2uef.fsf@gitster.g> (raw)
In-Reply-To: <cioavyfxwgdhfzuodb7dnwzmvsui4xcxi6mljnlszjwebogajg@taejma43hgtx> ("Carlo Marcelo Arenas Belón"'s message of "Sun, 15 Jun 2025 20:53:42 -0700")

Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:

> On Sun, Jun 15, 2025 at 11:08:27PM -0800, Rodrigo Michelassi wrote:
>> From: rodrigocmichelassi <rodmichelassi@gmail.com>
>> 
>> 'test_path_is_file', 'test_path_is_dir' and 'test_file_is_executable' are modern path checking methods in Git's development. Replace the basic shell commands 'test -f', 'test -d' and 'test -e', respectively, with this approach
>
> Splitting this long line, into multiple lines of about 70ish columns is
> better, see the relevant documents in Documentation/ for useful suggestions.
>
>> Signed-off-by: Rodrigo Michelassi <rodmichelassi@gmail.com>
>
> This certifies that you are the author of the code, an therefore should go
> after Isabella's, who might be the original author which you improved upon.
>
>> @@ -474,7 +474,7 @@ test_expect_success 'local clone --shared from linked checkout' '
>>  
>>  test_expect_success '"add" worktree with --no-checkout' '
>>  	git worktree add --no-checkout -b swamp swamp &&
>> -	! test -e swamp/init.t &&
>> +	! test_path_is_executable swamp/init.t &&
>
> this is not acurate translation, `test -e` is true if there is any "file"
> with that name, the equivalent for that helper function would be `test -x`

Yes, "test_path_is_missing" is what you want here, without any "!",
to make sure that the path does not exist.

      reply	other threads:[~2025-06-16  4:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16  2:08 [PATCH] replace 'test -[efd]' with 'test_path_is_[file,dir,executable]' Rodrigo Michelassi
2025-06-16  3:39 ` Eric Sunshine
2025-06-16  4:15   ` Junio C Hamano
2025-06-16  4:17     ` Eric Sunshine
2025-06-16  3:53 ` Carlo Marcelo Arenas Belón
2025-06-16  4:16   ` 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=xmqqwm9c2uef.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=icaselli@usp.br \
    --cc=rodmichelassi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.