From: Phillip Wood Date: Thu, 21 Jul 2022 14:03:57 GMT Subject: Re: [PATCH v5 08/12] rebase: update refs from 'update-ref' commands Message-ID: <3ae0c41e-2d18-d496-9b99-a672bf274faa@gmail.com> In-Reply-To: Hi Stolee On 19/07/2022 19:33, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee > > +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. > + 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