git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: Emily Shaffer <emilyshaffer@google.com>,
	Josh Steadmon <steadmon@google.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] connected: always use partial clone optimization
Date: Sun, 29 Mar 2020 10:39:54 -0700	[thread overview]
Message-ID: <xmqqeetbawlx.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200326231416.GC12694@google.com> (Josh Steadmon's message of "Thu, 26 Mar 2020 16:14:16 -0700")

Josh Steadmon <steadmon@google.com> writes:

>> 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.

  reply	other threads:[~2020-03-29 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 22:00 [PATCH] connected: always use partial clone optimization Jonathan Tan
2020-03-20 22:54 ` Junio C Hamano
2020-03-26 19:01 ` Josh Steadmon
2020-03-26 21:11 ` Emily Shaffer
2020-03-26 23:14   ` Josh Steadmon
2020-03-29 17:39     ` Junio C Hamano [this message]
2020-03-30  3:32       ` Jonathan Tan
2020-03-30  5:12         ` Junio C Hamano
2020-03-30 16:04           ` Jonathan Tan
2020-03-30 18:09             ` Junio C Hamano
2020-03-30 13:37   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqeetbawlx.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=steadmon@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).