Re: [PATCH v3 7/8] rebase: update refs from 'update-ref' commands
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Jun 29, 2022, 13:06 UTC
- Message-ID
- <ecca0613-069a-a081-0326-6fa6c6b35569@github.com>
- In-Reply-To
- <72e0481b643e98c5670eee0bf5c199c4fb693b16.1656422759.git.gitgitgadget@gmail.com>
On 6/28/22 9:25 AM, Derrick Stolee via GitGitGadget wrote:
> From: Derrick Stolee <derrickstolee@github.com>
Show 14 quoted lines
> +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