Re: [PATCH 1/1] t1403: prefer test_path_exists helper function
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 4, 2025, 12:05 UTC
- Message-ID
- <xmqqldtlt304.fsf@gitster.g>
- In-Reply-To
- <CABGrwBB1-UiiPEOptN9csVP1WYg2X=SWeMxxiyDfz02VmDp1vA@mail.gmail.com>
Mahendra Dani <danimahendra0904@gmail.com> writes:
Show 16 quoted lines
>> > remove_object() {
>> > file=$(sha1_file "$*") &&
>> > - test -e "$file" &&
>> > + test_path_exists "$file" &&
>> > rm -f "$file"
>> > } &&
>>
>> The refactoring is true to the original spirit of the preimage indeed.
>> But we could also improve it even further if we verified that the path
>> not only exists, but exists and is a file via `test_path_is_file()`. If
>> we decide to do that we should also explain the change in the commit
>> message.
>
> Yes, sure.
> I will improve it further using the `test_path_is_file()` helper
> function and change the commit message in v2 patch.You may want to think about why there is "-f" there. If we remove it, do we still need to have any check there?