зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
765428699a
Коммит
0f974e2124
|
@ -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)
|
||||
if (get_sha1("HEAD", sha1) && (opts->action == REPLAY_REVERT))
|
||||
return error(_("Can't revert as initial commit"));
|
||||
return error(_("Can't cherry-pick into empty head"));
|
||||
}
|
||||
save_head(sha1_to_hex(sha1));
|
||||
save_opts(opts);
|
||||
return pick_commits(todo_list, opts);
|
||||
|
|
Загрузка…
Ссылка в новой задаче