On Tue, Jun 12, 2012 at 08:43:41PM +0200, Andreas Schwab wrote: > Jeff King <peff@xxxxxxxx> writes: > > > We could close it in both cases by tweaking the mtime of the file > > containing the object when we decide not to write because the object > > already exists. > > Though there is always the window between the existence check and the > mtime update where pruning can hit you. For the loose object case, you could do them both atomically by calling utime() on the object, and considering the object to exist only if it succeeds. Doing it safely for packs would be harder, though; I think you'd have to bump the mtime forward, do the search, and then bump it back. You might err by causing a pack not to be pruned, but that is better than the opposite. Unfortunately it gets trickier with network transfers. If somebody is pushing to your repository, you might tell them you have some set of objects, then they prepare a pack based on that assumption (which might take minutes or hours to transfer), and then finally at the end you find that you actually need the objects in question. Of course, that race is even harder to trigger, because we do not advertise unreachable objects. So you would have to have a sequence where the objects are reachable, the client connects and receives your ref advertisement, then the objects become unreachable (e.g., due to a simultaneous non-ff push or deletion), and you do a prune in that interval which removes the objects. Unlikely, but still possible. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html