diff mbox series

[v2,4/7] sequencer: add update-refs command

Message ID 842b2186d250aca367e9680105d4d15f8cbb098e.1654634569.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series rebase: update branches in multi-part topic | expand

Commit Message

Derrick Stolee June 7, 2022, 8:42 p.m. UTC
From: Derrick Stolee <derrickstolee@github.com>

Add the boilerplat for an "update-refs" command in the sequencer. This
connects to the current no-op do_update_refs() which will be filled in
after more connections are created.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
 sequencer.c | 13 ++++++++++++-
 sequencer.h |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sequencer.c b/sequencer.c
index 8e26c9a6261..68f7c76e896 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1696,6 +1696,7 @@  static struct {
 	[TODO_LABEL] = { 'l', "label" },
 	[TODO_RESET] = { 't', "reset" },
 	[TODO_MERGE] = { 'm', "merge" },
+	[TODO_UPDATE_REFS] = { 'u', "update-refs" },
 	[TODO_NOOP] = { 0,   "noop" },
 	[TODO_DROP] = { 'd', "drop" },
 	[TODO_COMMENT] = { 0,   NULL },
@@ -2442,7 +2443,9 @@  static int parse_insn_line(struct repository *r, struct todo_item *item,
 	padding = strspn(bol, " \t");
 	bol += padding;
 
-	if (item->command == TODO_NOOP || item->command == TODO_BREAK) {
+	if (item->command == TODO_NOOP ||
+	    item->command == TODO_BREAK ||
+	    item->command == TODO_UPDATE_REFS) {
 		if (bol != eol)
 			return error(_("%s does not accept arguments: '%s'"),
 				     command_to_string(item->command), bol);
@@ -4056,6 +4059,11 @@  leave_merge:
 	return ret;
 }
 
+static int do_update_refs(struct repository *r)
+{
+	return 0;
+}
+
 static int is_final_fixup(struct todo_list *todo_list)
 {
 	int i = todo_list->current;
@@ -4431,6 +4439,9 @@  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_REFS) {
+			if ((res = do_update_refs(r)))
+				reschedule = 1;
 		} else if (!is_noop(item->command))
 			return error(_("unknown command %d"), item->command);
 
diff --git a/sequencer.h b/sequencer.h
index da64473636b..c2b4e148d8f 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -95,6 +95,7 @@  enum todo_command {
 	TODO_LABEL,
 	TODO_RESET,
 	TODO_MERGE,
+	TODO_UPDATE_REFS,
 	/* commands that do nothing but are counted for reporting progress */
 	TODO_NOOP,
 	TODO_DROP,