diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2016-06-06 15:23:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-06 12:59:28 -0700 |
commit | 0f974e2124e5220674eee079988b87e23f5e2de1 (patch) | |
tree | 6c26e7dd7d43ae3298e67fa6be99f3301b1425e4 /sequencer.c | |
parent | Git 2.4.11 (diff) | |
download | tgif-0f974e2124e5220674eee079988b87e23f5e2de1.tar.xz |
cherry-pick: allow to pick to unborn branches
cherry-pick allows to pick single commits to an empty HEAD, but not
multiple commits.
Allow the multiple commit case, too.
Reported-by: Fabrizio Cucci <fabrizio.cucci@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 c4f4b7d571..c051d134c2 100644 --- a/sequencer.c +++ b/sequencer.c @@ -919,6 +919,10 @@ static int sequencer_rollback(struct replay_opts *opts) filename); 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(); @@ -1118,11 +1122,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); |