Subject: Re: [PATCH] t0410: modernize delete_object helper

From: Junio C Hamano <[email-masked]>
Date: Thu, 12 Mar 2026 12:09:05 -0700

Eric Sunshine <[email-masked]> writes:

>> diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
>> @@ -11,7 +11,11 @@ test_description='partial clone'
>>  delete_object () {
>> -       rm $1/.git/objects/$(echo $2 | sed -e 's|^..|&/|')
>> +       repo=$1
>> +       obj=$2
>> +       path="$repo/.git/objects/$(test_oid_to_path $obj)" &&
>> +       test_path_is_file "$path" &&
>> +       rm "$path"
>>  }
>
> Despite what the commit message says, adding a call to
> `test_path_is_file` here does not add value since `rm` will already
> fail noisily and exit with an error code if the path does not exist.
> Moreover, because it's unnecessary, the `test_path_is_file` invocation
> may confuse readers into thinking that something subtle is going on
> that requires extra scrutiny and care even though that's not the case.
> So let's not add this needless extra code.

Good to point this out.  Use of test_oid_to_path would still be
good, though.

Thanks.