From: Derrick Stolee Date: Wed, 29 Jun 2022 13:06:58 GMT Subject: Re: [PATCH v3 7/8] rebase: update refs from 'update-ref' commands Message-ID: In-Reply-To: <72e0481b643e98c5670eee0bf5c199c4fb693b16.1656422759.git.gitgitgadget@gmail.com> On 6/28/22 9:25 AM, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee > +static int write_update_refs_state(struct string_list *refs_to_oids) > +{ > + int result = 0; > + FILE *fp = NULL; > + struct string_list_item *item; > + char *path = xstrdup(rebase_path_update_refs()); > + > + if (safe_create_leading_directories(path)) { > + result = error(_("unable to create leading directories of %s"), > + path); > + goto cleanup; > + } > + > + fp = fopen(path, "w"); I realized (while trying to go to sleep, of course) that I need to use a lockfile here. Parallel processes might be reading this file while we are writing it. Thanks, -Stolee