Re: [PATCH v4 08/13] commit-graph: implement --delete-expired
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 23, 2018, 19:33 UTC
- Message-ID
- <xmqqo9kftsa5.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <67871288-ea70-69d4-9c3d-5cc946d8dbe2@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 10 quoted lines
> 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?