rebase -i: introduce --recreate-merges=[no-]rebase-cousins
[gitweb.git] / sequencer.c
index 0bb59e4411528a5cf3dee9b7d3db2c3514cb32c8..d8cc63dbe4da9553ae96b42f244c3c043bf56dc7 100644 (file)
@@ -2937,6 +2937,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
                                   unsigned flags)
 {
        int keep_empty = flags & TODO_LIST_KEEP_EMPTY;
+       int rebase_cousins = flags & TODO_LIST_REBASE_COUSINS;
        struct strbuf buf = STRBUF_INIT, oneline = STRBUF_INIT;
        struct strbuf label = STRBUF_INIT;
        struct commit_list *commits = NULL, **tail = &commits, *iter;
@@ -3112,6 +3113,9 @@ static int make_script_with_merges(struct pretty_print_context *pp,
                                           &commit->object.oid);
                        if (entry)
                                to = entry->string;
+                       else if (!rebase_cousins)
+                               to = label_oid(&commit->object.oid, NULL,
+                                              &state);
 
                        if (!to || !strcmp(to, "onto"))
                                fprintf(out, "%s onto\n", cmd_reset);