Hi Michael, On Thu, 14 Sep 2017, Michael Haggerty wrote:
> On 09/13/2017 07:15 PM, Michael Haggerty wrote: > > [...] > > * `mmap()` the whole file rather than `read()`ing it. > > [...] > > Apparently this doesn't work on Windows, because the `snapshot` is > keeping the `packed-refs` file open too long, so the new file can't be > renamed on top of it. Indeed, I sent you a mail about it before I checked for new mails ;-) > I didn't realize that this is even allowed, but TIL that you can close a > file while keeping it mmapped. Does that technique work on Windows? If > so, I'll change v2 to do it as sketched below. I do not know whether that technique works on Windows, but it would not solve the problem *entirely*, as I outlined in my reply: in delete_branches(), for example, the main_worktree_ref_store is implicitly getting its snapshot initialized, and nothing seems to release it. This is only one example, as I figure that multiple worktrees could cause even more ref_stores to have unreleased snapshots of the packed-refs file. I imagine that something like close_all_packs() is needed ("clear_all_snapshots()"?). Ciao, Dscho