Re: [PATCH v2 4/5] fetch: teach independent negotiation (no packfile)
- From
Derrick Stolee <stolee@gmail.com>
- Date
- May 5, 2021, 16:44 UTC
- Message-ID
- <f2acf884-8930-a3fd-ec4d-601652b2ec24@gmail.com>
- In-Reply-To
- <1de34a6dced3f5477162dd675615342bc2dec05f.1620162764.git.jonathantanmy@google.com>
On 5/4/2021 5:16 PM, Jonathan Tan wrote:
Show 15 quoted lines
> +void negotiate_using_fetch(const struct oid_array *negotiation_tips,
> + const struct string_list *server_options,
> + int stateless_rpc,
> + int fd[],
> + struct oidset *acked_commits)
> +{
> + struct fetch_negotiator negotiator;
> + struct packet_reader reader;
> + struct object_array nt_object_array = OBJECT_ARRAY_INIT;
> + struct strbuf req_buf = STRBUF_INIT;
> + int haves_to_send = INITIAL_FLUSH;
> + int in_vain = 0;
> + int seen_ack = 0;
> + int last_iteration = 0;
> + timestamp_t min_generation = GENERATION_NUMBER_INFINITY;...
Show 27 quoted lines
> + /* Process ACKs/NAKs */
> + process_section_header(&reader, "acknowledgments", 0);
> + while (process_ack(&negotiator, &reader, &common_oid,
> + &received_ready)) {
> + struct commit *commit = lookup_commit(the_repository,
> + &common_oid);
> + if (commit) {
> + timestamp_t generation;
> +
> + parse_commit_or_die(commit);
> + commit->object.flags |= COMMON;
> + generation = commit_graph_generation(commit);
> + if (generation < min_generation)
> + min_generation = generation;
> + }
> + in_vain = 0;
> + seen_ack = 1;
> + oidset_insert(acked_commits, &common_oid);
> + }
> + if (received_ready)
> + die(_("unexpected 'ready' from remote"));
> + else
> + do_check_stateless_delimiter(stateless_rpc, &reader);
> + if (can_all_from_reach_with_flag(&nt_object_array, COMMON,
> + REACH_SCRATCH, 0,
> + min_generation))
> + last_iteration = 1;I'm just chiming in to confirm that this use of min_generation is correct. Thanks!
-Stolee