Taylor Blau <me@xxxxxxxxxxxx> writes: > Ævar makes a slight mention of this in their commit message: > > This approach of reusing the buffer does make the last user in > pack-object.c's write_pack_file() slightly awkward, since we > needlessly do a strbuf_setlen() before calling strbuf_release() for > consistency. In subsequent changes we'll move that bitmap writing > code around, so let's not skip the strbuf_setlen() now. > > And this is to set us up for the final patch which moves the call to > rename_tmp_packfile_idx(&tmpname, &idx_tmp_name) after the closing brace > in the quoted portion of your message and the strbuf_release(). There, > we'll want the strbuf reset to the appropriate contents and length, and > not released. > > But in the meantime it is awkward. That is why I said "adding setlen only when t starts to matter may make it easier to follow". It won't make it awkward at this step, and it will make it stand out why it is needed when it is added, presumably at the very end, when rename_tmp_packfile_idx() call is added after this if() block.