Re: [PATCH] t0410: modernize delete_object helper
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 12, 2026, 22:03 UTC
- Message-ID
- <xmqqwlzgaeo2.fsf@gitster.g>
- In-Reply-To
- <20260312203337.GA2552877@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> On Thu, Mar 12, 2026 at 06:20:30PM +0530, Siddharth Shrimali wrote:
>
>> 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"
>> }
>
> It might worth marking these new variables with "local". They are not
> used elsewhere by the script currently, but they are common enough names
> that a collision in the future doesn't seem that unlikely.Yes, and another thing that was pointed out is it is dubious to use test_path_is_file here, as "rm" would be loud enough when it fails.