Hi Stolee On 19/07/2022 19:33, Derrick Stolee via GitGitGadget wrote:
From: Derrick Stolee <derrickstolee@xxxxxxxxxx> +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