Re: [PATCH 2/6] fetch-pack: truly stop negotiation upon ACK ready
flat view
From: Jonathan Tan <hidden>
Date: 2018-06-06 00:38:23
On Tue, 5 Jun 2018 16:16:34 -0700 Jonathan Nieder [off-list ref] wrote:
Hi, Jonathan Tan wrote:quoted
When "ACK %s ready" is received, find_common() clears rev_list in an attempt to stop further "have" lines from being sent [1]. This appears to work, despite the invocation to mark_common() in the "while" loop.Does "appears to work" mean "works" or "doesn't work but does an okay job of faking"?
"Appears to work" means I think that it works, but I don't think I can
conclusively prove it.
quoted
Though it is possible for mark_common() to invoke rev_list_push() (thus making rev_list non-empty once more), it is more likely that the commitsnit: s/more likely/most likely/ or s/it is more likely that/usually/quoted
in rev_list that have un-SEEN parents are also unparsed, meaning that mark_common() is not invoked on them. To avoid all this uncertainty, it is better to explicitly end the loop when "ACK %s ready" is received instead of clearing rev_list. Remove the clearing of rev_list and write "if (got_ready) break;" instead.I'm still a little curious about whether this can happen in practice or whether it's just about readability (or whether you didn't figure out which, which is perfectly fine), but either way it's a good change.
I tried to figure out which, but concluded that I can't.
I think that in v2's commit message, I'll start with describing the
readability aspect.
quoted
@@ -1281,7 +1281,6 @@ static int process_acks(struct packet_reader *reader, struct oidset *common) } if (!strcmp(reader->line, "ready")) { - clear_prio_queue(&rev_list); received_ready = 1; continue;I'm curious about the lifetime of &rev_list. Does the priority queue get freed eventually?
No (which potentially causes a problem in the case that fetch-pack is
invoked twice), but I fix that in patch 4/6, so I didn't bother
addressing it here. I'll add a note about the lifetime of this priority
queue in v2.