Re: [PATCH v3 5/8] sequencer: add update-ref command
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jun 30, 2022, 09:39 UTC
- Message-ID
- <1ce55924-c151-3d27-90d6-82fed92a4d91@gmail.com>
- In-Reply-To
- <e95ad41d3551244ea98c43145a089ecfd2536e54.1656422759.git.gitgitgadget@gmail.com>
On 28/06/2022 14:25, Derrick Stolee via GitGitGadget wrote:
Show 18 quoted lines
> From: Derrick Stolee <derrickstolee@github.com>
>
> 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 <ref-name>" to signal
> that we should store the current commit as the value for updating
> <ref-name> 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