general improvements
[gitweb.git] / builtin / rebase.c
index 27d5c4e19d1c16491060aff4a05500917fb28be1..4a20582e724b00a565ee8b0fd05137a11b27568c 100644 (file)
@@ -62,7 +62,7 @@ struct rebase_options {
        const char *onto_name;
        const char *revisions;
        const char *switch_to;
-       int root;
+       int root, root_with_onto;
        struct object_id *squash_onto;
        struct commit *restrict_revision;
        int dont_finish_rebase;
@@ -374,6 +374,7 @@ static int run_rebase_interactive(struct rebase_options *opts,
        flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
        flags |= opts->rebase_merges ? TODO_LIST_REBASE_MERGES : 0;
        flags |= opts->rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0;
+       flags |= opts->root_with_onto ? TODO_LIST_ROOT_WITH_ONTO : 0;
        flags |= command == ACTION_SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0;
 
        switch (command) {
@@ -1863,15 +1864,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                              "'--reschedule-failed-exec'"));
        }
 
-       if (options.rebase_merges) {
-               if (strategy_options.nr)
-                       die(_("cannot combine '--rebase-merges' with "
-                             "'--strategy-option'"));
-               if (options.strategy)
-                       die(_("cannot combine '--rebase-merges' with "
-                             "'--strategy'"));
-       }
-
        if (!options.root) {
                if (argc < 1) {
                        struct branch *branch;
@@ -1902,7 +1894,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                        options.squash_onto = &squash_onto;
                        options.onto_name = squash_onto_name =
                                xstrdup(oid_to_hex(&squash_onto));
-               }
+               } else
+                       options.root_with_onto = 1;
+
                options.upstream_name = NULL;
                options.upstream = NULL;
                if (argc > 1)
@@ -2008,9 +2002,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                                state_dir_path("autostash", &options);
                        struct child_process stash = CHILD_PROCESS_INIT;
                        struct object_id oid;
-                       struct commit *head =
-                               lookup_commit_reference(the_repository,
-                                                       &options.orig_head);
 
                        argv_array_pushl(&stash.args,
                                         "stash", "create", "autostash", NULL);
@@ -2031,17 +2022,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                                    options.state_dir);
                        write_file(autostash, "%s", oid_to_hex(&oid));
                        printf(_("Created autostash: %s\n"), buf.buf);
-                       if (reset_head(&head->object.oid, "reset --hard",
+                       if (reset_head(NULL, "reset --hard",
                                       NULL, RESET_HEAD_HARD, NULL, NULL) < 0)
                                die(_("could not reset --hard"));
-                       printf(_("HEAD is now at %s"),
-                              find_unique_abbrev(&head->object.oid,
-                                                 DEFAULT_ABBREV));
-                       strbuf_reset(&buf);
-                       pp_commit_easy(CMIT_FMT_ONELINE, head, &buf);
-                       if (buf.len > 0)
-                               printf(" %s", buf.buf);
-                       putchar('\n');
 
                        if (discard_index(the_repository->index) < 0 ||
                                repo_read_index(the_repository) < 0)