Merge branch 'jk/gpg-interface-cleanup'
[gitweb.git] / sequencer.c
index 4687ad4b80bf651fd9dab66916681b71f7a6e31d..c6362d63f35fe37d67fa235784ab8ce75a60db44 100644 (file)
@@ -888,6 +888,10 @@ static int sequencer_rollback(struct replay_opts *opts)
                        git_path_head_file());
                goto fail;
        }
+       if (is_null_sha1(sha1)) {
+               error(_("cannot abort from a branch yet to be born"));
+               goto fail;
+       }
        if (reset_for_rollback(sha1))
                goto fail;
        remove_sequencer_state();
@@ -1086,11 +1090,8 @@ int sequencer_pick_revisions(struct replay_opts *opts)
        walk_revs_populate_todo(&todo_list, opts);
        if (create_seq_dir() < 0)
                return -1;
-       if (get_sha1("HEAD", sha1)) {
-               if (opts->action == REPLAY_REVERT)
-                       return error(_("Can't revert as initial commit"));
-               return error(_("Can't cherry-pick into empty head"));
-       }
+       if (get_sha1("HEAD", sha1) && (opts->action == REPLAY_REVERT))
+               return error(_("Can't revert as initial commit"));
        save_head(sha1_to_hex(sha1));
        save_opts(opts);
        return pick_commits(todo_list, opts);