Subject: Re: [PATCH v2 3/7] fetch: control lifecycle of FETCH_HEAD in a single place

From: Junio C Hamano <[email-masked]>
Date: Thu, 17 Feb 2022 14:12:20 -0800

Patrick Steinhardt <[email-masked]> 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.