Re: [PATCH v5 08/12] rebase: update refs from 'update-ref' commands
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jul 21, 2022, 14:03 UTC
- Message-ID
- <3ae0c41e-2d18-d496-9b99-a672bf274faa@gmail.com>
- In-Reply-To
- <e7a91bdffbd9a1fe0eda9a5a264f7734aadbf688.1658255624.git.gitgitgadget@gmail.com>
Hi Stolee
On 19/07/2022 19:33, Derrick Stolee via GitGitGadget wrote:
Show 9 quoted lines
> From: Derrick Stolee <derrickstolee@github.com>
>
> +static int do_update_ref(struct repository *r, const char *refname)
> {
> + struct string_list_item *item;
> + struct string_list list = STRING_LIST_INIT_DUP;
> +
> + if (sequencer_get_update_refs_state(r->gitdir, &list))
> + return -1;This is good, we now return an error if we cannot read the update-refs file.
Show 10 quoted lines
> + for_each_string_list_item(item, &list) {
> + if (!strcmp(item->string, refname)) {
> + struct update_ref_record *rec = item->util;
> + if (read_ref("HEAD", &rec->after))
> + return -1;
> + break;
> + }
> + }
> +
> + write_update_refs_state(&list);The return value of write_update_refs_state() should be propagated to the caller.
> + string_list_clear(&list, 1); > return 0; > }
Best Wishes
Phillip