From: Junio C Hamano Date: Fri, 23 Feb 2018 19:33:38 GMT Subject: Re: [PATCH v4 08/13] commit-graph: implement --delete-expired Message-ID: In-Reply-To: <67871288-ea70-69d4-9c3d-5cc946d8dbe2@gmail.com> Derrick Stolee writes: > The (unlikely, but possible) race condition involves two processes (P1 > and P2): > > 1. P1 reads from graph-latest to see commit graph file F1. > 2. P2 updates graph-latest to point to F2 and deletes F1. > 3. P1 tries to read F1 and fails. > > I could explicitly mention this condition in the message, or we can > just let P2 fail by deleting all files other than the one referenced > by 'graph-latest'. Thoughts? The established way we do this is not to have -latest pointer, I would think, and instead, make -latest be the actual thing. That is how $GIT_DIR/index is updated, for example, by first writing into a temporary file and then moving it to the final destination. Is there a reason why the same pattern cannot be used?