@@ -164,6 +164,7 @@ static int resolve_commit_list(const struct string_list *str,
static int resolve_edits_commit_list(struct sequence_edits *edits)
{
return resolve_commit_list(&edits->drop, &edits->revs) ||
+ resolve_commit_list(&edits->breaks, &edits->revs) ||
resolve_commit_list(&edits->edit, &edits->revs) ||
resolve_commit_list(&edits->reword, &edits->revs);
}
@@ -302,6 +303,8 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
N_("restrict-revision"), N_("restrict revision")),
OPT_STRING(0, "squash-onto", &squash_onto, N_("squash-onto"),
N_("squash onto")),
+ OPT_STRING_LIST(0, "break", &edits.breaks, N_("revision"),
+ N_("stop before the mentioned ref")),
OPT_STRING_LIST(0, "drop", &edits.drop, N_("revision"),
N_("drop the mentioned ref from the "
"todo list")),
@@ -1053,6 +1053,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
NULL };
const char *gpg_sign = NULL;
struct string_list exec = STRING_LIST_INIT_NODUP;
+ struct string_list breaks = STRING_LIST_INIT_NODUP;
struct string_list reword = STRING_LIST_INIT_NODUP;
struct string_list edit = STRING_LIST_INIT_NODUP;
struct string_list drop = STRING_LIST_INIT_NODUP;
@@ -1138,6 +1139,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_STRING_LIST('x', "exec", &exec, N_("exec"),
N_("add exec lines after each commit of the "
"editable list")),
+ OPT_STRING_LIST(0, "break", &breaks, N_("revision"),
+ N_("stop before the mentioned ref")),
OPT_STRING_LIST(0, "drop", &drop, N_("revision"),
N_("drop the mentioned ref from the "
"todo list")),
@@ -1404,6 +1407,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
options.cmd = xstrdup(buf.buf);
}
+ forward_switches(&options, "--break", &breaks);
forward_switches(&options, "--drop", &drop);
forward_switches(&options, "--edit", &edit);
forward_switches(&options, "--reword", &reword);
@@ -4261,6 +4261,7 @@ static const char *label_oid(struct object_id *oid, const char *label,
void free_sequence_edits(struct sequence_edits *edits)
{
+ string_list_clear(&edits->breaks, 0);
string_list_clear(&edits->drop, 0);
string_list_clear(&edits->edit, 0);
string_list_clear(&edits->reword, 0);
@@ -4294,6 +4295,7 @@ static int check_unused_refs(const struct string_list *refs)
static int check_unused_edits(const struct sequence_edits *edits)
{
return check_unused_refs(&edits->drop) ||
+ check_unused_refs(&edits->breaks) ||
check_unused_refs(&edits->edit) ||
check_unused_refs(&edits->reword);
}
@@ -4320,6 +4322,11 @@ static void add_edit_todo_inst(struct strbuf *buf, const struct object_id *oid,
{
enum todo_command cmd = TODO_PICK;
+ if (consume_oid(oid, &edits->breaks)) {
+ add_todo_cmd(buf, TODO_BREAK, flags);
+ strbuf_addstr(buf, "\n");
+ }
+
if (consume_oid(oid, &edits->drop))
cmd = TODO_DROP;
else if (consume_oid(oid, &edits->edit))
@@ -139,6 +139,7 @@ int sequencer_remove_state(struct replay_opts *opts);
*/
struct sequence_edits {
struct commit_list *revs;
+ struct string_list breaks;
struct string_list drop;
struct string_list edit;
struct string_list reword;