git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-pack: clean up extra_have oid array

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2025, 21:12 UTC
Message-ID
<xmqqwm8ripii.fsf@gitster.g>
In-Reply-To
<753b6548-9b7c-411a-ab39-adbf769f83bd@intel.com>
Jacob Keller <jacob.e.keller@intel.com> writes:
Show 50 quoted lines
> On 7/1/2025 10:40 AM, Junio C Hamano wrote:
>> Jacob Keller <jacob.e.keller@intel.com> writes:
>> 
>>> diff --git a/builtin/send-pack.c b/builtin/send-pack.c
>>> index c6e0e9d05186..61486e378cab 100644
>>> --- a/builtin/send-pack.c
>>> +++ b/builtin/send-pack.c
>>> @@ -343,6 +343,7 @@ int cmd_send_pack(int argc,
>>>  	free_refs(remote_refs);
>>>  	free_refs(local_refs);
>>>  	refspec_clear(&rs);
>>> +	oid_array_clear(&extra_have);
>>>  	oid_array_clear(&shallow);
>>>  	clear_cas_option(&cas);
>>>  	return ret;
>> 
>> There is an early exit from the function that would bypass these
>> clean-up.  Perhaps something like this on top?
>> 
>>  builtin/send-pack.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>> 
>> diff --git c/builtin/send-pack.c w/builtin/send-pack.c
>> index b28da7ddd7..6ce9f6665a 100644
>> --- c/builtin/send-pack.c
>> +++ w/builtin/send-pack.c
>> @@ -305,9 +305,10 @@ int cmd_send_pack(int argc,
>>  		flags |= MATCH_REFS_MIRROR;
>>  
>>  	/* match them up */
>> -	if (match_push_refs(local_refs, &remote_refs, &rs, flags))
>> -		return -1;
>> -
>> +	if (match_push_refs(local_refs, &remote_refs, &rs, flags)) {
>> +		ret = -1;
>> +		goto cleanup;
>> +	}
>>  	if (!is_empty_cas(&cas))
>>  		apply_push_cas(&cas, remote, remote_refs);
>>  
>> @@ -340,6 +341,7 @@ int cmd_send_pack(int argc,
>>  		/* stable plumbing output; do not modify or localize */
>>  		fprintf(stderr, "Everything up-to-date\n");
>>  
>> +cleanup:
>>  	string_list_clear(&push_options, 0);
>>  	free_refs(remote_refs);
>>  	free_refs(local_refs);
>
> This addition looks good to me.

Thanks for a quick sanity check. I'll queue it on top of yours, then.

Previous: Jacob KellerNext: Jeff King
Message 6 of 9 in “send-pack: clean up extra_have oid array”
  1. send-pack: clean up extra_have oid arrayJacob Keller, Jun 27, 2025
  2. Junio C HamanoJun 30, 2025
  3. Jacob KellerJun 30, 2025
  4. Junio C HamanoJul 1, 2025
  5. Jacob KellerJul 1, 2025
  6. Junio C HamanoJul 1, 2025
  7. Jeff KingJul 3, 2025
  8. Jacob KellerJul 3, 2025
  9. Jeff KingJul 3, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.