summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-07-19 18:33:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-19 19:49:03 (GMT)
commita97d79163e16e2d3777ab4d86c8f006f260c2836 (patch)
tree29ca62fe322c23ef3e96704dc14f954860d7e2ce /sequencer.c
parentd7ce9a220196b995117252bb236baf135c9b704f (diff)
downloadgit-a97d79163e16e2d3777ab4d86c8f006f260c2836.zip
git-a97d79163e16e2d3777ab4d86c8f006f260c2836.tar.gz
git-a97d79163e16e2d3777ab4d86c8f006f260c2836.tar.bz2
sequencer: add update-ref command
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. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index bcfd25c..cac18a7 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1723,6 +1723,7 @@ static struct {
[TODO_LABEL] = { 'l', "label" },
[TODO_RESET] = { 't', "reset" },
[TODO_MERGE] = { 'm', "merge" },
+ [TODO_UPDATE_REF] = { 'u', "update-ref" },
[TODO_NOOP] = { 0, "noop" },
[TODO_DROP] = { 'd', "drop" },
[TODO_COMMENT] = { 0, NULL },
@@ -2504,7 +2505,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
command_to_string(item->command));
if (item->command == TODO_EXEC || item->command == TODO_LABEL ||
- item->command == TODO_RESET) {
+ item->command == TODO_RESET || item->command == TODO_UPDATE_REF) {
item->commit = NULL;
item->arg_offset = bol - buf;
item->arg_len = (int)(eol - bol);
@@ -4104,6 +4105,11 @@ leave_merge:
return ret;
}
+static int do_update_ref(struct repository *r, const char *ref_name)
+{
+ return 0;
+}
+
static int is_final_fixup(struct todo_list *todo_list)
{
int i = todo_list->current;
@@ -4479,6 +4485,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);
+ if ((res = do_update_ref(r, ref.buf)))
+ reschedule = 1;
+ strbuf_release(&ref);
} else if (!is_noop(item->command))
return error(_("unknown command %d"), item->command);