From: Phillip Wood Date: Thu, 30 Jun 2022 09:39:59 GMT Subject: Re: [PATCH v3 5/8] sequencer: add update-ref command Message-ID: <1ce55924-c151-3d27-90d6-82fed92a4d91@gmail.com> In-Reply-To: On 28/06/2022 14:25, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee > > Add the boilerplate for an "update-ref" command in the sequencer. This > connects to the current no-op do_update_ref() which will be filled in > after more connections are created. > > The syntax in the todo list will be "update-ref " to signal > that we should store the current commit as the value for updating > at the end of the rebase. > > [...] > @@ -4431,6 +4437,12 @@ static int pick_commits(struct repository *r, > return error_with_patch(r, item->commit, > arg, item->arg_len, > opts, res, 0); > + } else if (item->command == TODO_UPDATE_REF) { > + struct strbuf ref = STRBUF_INIT; > + strbuf_add(&ref, arg, item->arg_len); It's a bit of a shame we have to faff here just to get a NULL terminated string. It does not matter but using xmemdupz() & free() would be one less line. > + if ((res = do_update_ref(r, ref.buf))) > + reschedule = 1; Rescheduling here is good Best Wishes Phillip