> Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes: > > > @@ -126,6 +129,12 @@ static int read_pack_objects_stdout(int outfd, struct output_state *os) > > } > > os->used += readsz; > > > > + if (!os->packfile_started) { > > + os->packfile_started = 1; > > + if (use_protocol_v2) > > + packet_write_fmt(1, "packfile\n"); > > If we fix this function so that the only byte in the buffer is held > back without emitted when os->used == 1 as I alluded to, this may > have to be done a bit later, as with such a change, it is no longer > guaranteed that send_client_data() will be called after this point. I'm not sure what you mean about there being no guarantee that send_client_data() is not called - in create_pack_file(), there is an "if (output_state.used > 0)" line (previously "if (0 <= buffered)") that outputs anything remaining. > Isn't progress output that goes to the channel #2 pretty much > independent from the payload stream that carries the pkt-line > command like "packfile" plus the raw pack stream? It somehow > feels like an oxymoron to _buffer_ progress indicator, as it > defeats the whole point of progress report to buffer it. Yes, it is - I don't fully like this part of the design. I alluded to a similar issue (keepalive) in the toplevel email [1] and that it might be better if the server can send sideband throughout the whole response - perhaps that should be investigated first. If we had sideband throughout the whole response, we wouldn't need to buffer the progress indicator. [1] https://public-inbox.org/git/cover.1543879256.git.jonathantanmy@xxxxxxxxxx/