summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-06-27 16:56:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-27 16:56:53 (GMT)
commitdb8128fee088d989dadb0b67da9e8ec5d67b6d97 (patch)
tree6b3e889b6722b1c98bee5206929eb9b84b064953 /sequencer.c
parent8579c4ebee0257ac98eaecdb77077e3baa96d0c9 (diff)
parent0f974e2124e5220674eee079988b87e23f5e2de1 (diff)
downloadgit-db8128fee088d989dadb0b67da9e8ec5d67b6d97.zip
git-db8128fee088d989dadb0b67da9e8ec5d67b6d97.tar.gz
git-db8128fee088d989dadb0b67da9e8ec5d67b6d97.tar.bz2
Merge branch 'mg/cherry-pick-multi-on-unborn'
"git cherry-pick A" worked on an unborn branch, but "git cherry-pick A..B" didn't. * mg/cherry-pick-multi-on-unborn: cherry-pick: allow to pick to unborn branches
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c
index 4687ad4..c6362d6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -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);