On Sun, Jul 31 2022, Matheus Tavares wrote: > +static void reply_list_available_blobs_cmd(void) > +{ > + struct hashmap_iter iter; > + struct strmap_entry *ent; > + struct string_list_item *str_item; > + struct string_list paths = STRING_LIST_INIT_NODUP; > + > + /* flush */ > + if (packet_read_line(0, NULL)) > + die("bad list_available_blobs end"); Shouldn't anything that's not an OS error (e.g. write error) be a BUG() instead in this code? I.e. it would be a bug in our own testcode if we feed the wrong data here, or if pkt-line doesn't work as we expect... > + > + strmap_for_each_entry(&delay, &iter, ent) { > + struct delay_entry *delay_entry = ent->value; > + if (!delay_entry->requested) > + continue; > + delay_entry->count--; > + if (!strcmp(ent->key, "invalid-delay.a")) { > + /* Send Git a pathname that was not delayed earlier */ > + packet_write_fmt(1, "pathname=unfiltered"); > + } > + if (!strcmp(ent->key, "missing-delay.a")) { > + /* Do not signal Git that this file is available */ > + } else if (!delay_entry->count) { > + string_list_append(&paths, ent->key); > + packet_write_fmt(1, "pathname=%s", ent->key); > + } > + } > + > + /* Print paths in sorted order. */ > + string_list_sort(&paths); > + for_each_string_list_item(str_item, &paths) > + fprintf(logfile, " %s", str_item->string); > + string_list_clear(&paths, 0); > + > + packet_flush(1); > + > + fprintf(logfile, " [OK]\n"); I think it should be called out in the commit message that this is not what the Perl version is doing, i.e. it does things like: print $debug " [OK]\n"; $debug->flush(); After having previously printed the equivalent of your for_each_string_list_item() to the log file. In Perl anything that uses PerlIO is subject to internal buffering, which doesn't have the same semantics as stdio buffering. I think in this case it won't matter, since you're not expecting to have concurrent writers. You could even use fputc() here. But a faithful reproduction of the Perl version would be something like appending the output here to a "struct strbuf", and then "flushing" it at the end when the perl version does a "$debug->flush()". I don't think that's worth the effort here, and we should just say that it doesn't matter. I just think we should note it. Thanks!