diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-07-06 13:06:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-06 13:06:42 -0700 |
commit | 25227f0beacf00d80420e313ffed48032352037f (patch) | |
tree | fd62848b872e6e03a93dd47f2e97164f4a1afaa4 /sequencer.c | |
parent | af3a43cb111bc3136389a9f1285fbccb97f42205 (diff) | |
parent | 0f974e2124e5220674eee079988b87e23f5e2de1 (diff) | |
download | git-25227f0beacf00d80420e313ffed48032352037f.tar.gz |
Merge branch 'mg/cherry-pick-multi-on-unborn' into maint
"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.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c index 4687ad4b80..c6362d63f3 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); |