Patrick Steinhardt <ps@xxxxxx> writes: > There are two different locations where we're appending to FETCH_HEAD: > first when storing updated references, and second when backfilling tags. > Both times we open the file, append to it and then commit it into place, > which is essentially duplicate work. > > Improve the lifecycle of updating FETCH_HEAD by opening and committing > it once in `do_fetch()`, where we pass the structure down to the code > which wants to append to it. OK. Each call to store_updated_refs() used to be responsible for opening, appending, committing, and closing FETCH_HEAD. We now make do_fetch() responsible for opening, committing, and closing, and let the direct and indirect callers of fetch_and_consume_refs() only worry about appending to it. Makes sense.