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

Re: [PATCH] connected: always use partial clone optimization

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 29, 2020, 17:39 UTC
Message-ID
<xmqqeetbawlx.fsf@gitster.c.googlers.com>
In-Reply-To
<20200326231416.GC12694@google.com>
Josh Steadmon <steadmon@google.com> writes:
Show 37 quoted lines
>> Having a look at the final structure of the loop with these gotos, I'm a
>> little confused. Could be this isn't C-idiomatic but I think the code
>> could be easier to read with helpers instead of gotos. I realize it's
>> longer but I have a hard time understanding that your gotos are used to
>> double-continue or double-break; nested loops tend to make me want to
>> use helpers. But - I'm a lowly barely-reformed C++ developer, so what do
>> I know ;)
>> 
>>   int oid_in_promisor(oid) {
>>     for (p = get_all_packs(the_repository); p; p = p->next) {
>>       if (!p->pack_promisor)
>>         continue;
>>       if (find_pack_entry_one(oid.hash, p)
>>         return 1;
>>     }
>>   }
>> 
>>   int all_oids_in_promisors(oid, fn, cb_data)
>>   {
>>     do {
>>       if (! oid_in_promisor(oid))
>>         return 0;
>>     } while (!fn(cb_data, &oid));
>>     return 1;
>>   }
>> 
>>   int check_connected(...)
>>   {
>>     ...
>>     if (has_promisor_remote()) {
>>       if (all_oids_in_promisors(oid, fn, cb_data))
>>         return 0;
>>       if (opt->shallow_file) {
>>        ...
>>   }
>
> I like this version better as well.

Sounds good. Jonathan? I've squashed Josh'es Reviewed-by, but I will refrain from merging it to 'next' just yet to see if you too like the proposed code structure.

Thanks, all.
Previous: Josh SteadmonNext: Jonathan Tan
Message 6 of 11 in “connected: always use partial clone optimization”
  1. connected: always use partial clone optimizationJonathan Tan, Mar 20, 2020
  2. Junio C HamanoMar 20, 2020
  3. Josh SteadmonMar 26, 2020
  4. Emily ShafferMar 26, 2020
  5. Josh SteadmonMar 26, 2020
  6. Junio C HamanoMar 29, 2020
  7. Jonathan TanMar 30, 2020
  8. Junio C HamanoMar 30, 2020
  9. Jonathan TanMar 30, 2020
  10. Junio C HamanoMar 30, 2020
  11. Jeff KingMar 30, 2020

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.