diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-07-24 21:50:48 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-24 21:50:48 (GMT) |
commit | d94cecfe7525606070163437f7c59a51650f9e56 (patch) | |
tree | c956ab875c2fd1109fd59c3a28c7033d789211ab /sequencer.c | |
parent | 9cb10ca9df2f95e97b5a75d7fea3087972c298ae (diff) | |
parent | c5e358d07355080ea0f7a56f1edcc2f28879d9f4 (diff) | |
download | git-d94cecfe7525606070163437f7c59a51650f9e56.zip git-d94cecfe7525606070163437f7c59a51650f9e56.tar.gz git-d94cecfe7525606070163437f7c59a51650f9e56.tar.bz2 |
Merge branch 'jk/empty-pick-fix'
Handling of an empty range by "git cherry-pick" was inconsistent
depending on how the range ended up to be empty, which has been
corrected.
* jk/empty-pick-fix:
sequencer: don't say BUG on bogus input
sequencer: handle empty-set cases consistently
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c index 349ae04..b89d5f2 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1864,8 +1864,6 @@ static int prepare_revs(struct replay_opts *opts) if (prepare_revision_walk(opts->revs)) return error(_("revision walk setup failed")); - if (!opts->revs->commits) - return error(_("empty commit set passed")); return 0; } @@ -2323,6 +2321,10 @@ static int walk_revs_populate_todo(struct todo_list *todo_list, short_commit_name(commit), subject_len, subject); unuse_commit_buffer(commit, commit_buffer); } + + if (!todo_list->nr) + return error(_("empty commit set passed")); + return 0; } @@ -3658,8 +3660,10 @@ int sequencer_pick_revisions(struct replay_opts *opts) if (prepare_revision_walk(opts->revs)) return error(_("revision walk setup failed")); cmit = get_revision(opts->revs); - if (!cmit || get_revision(opts->revs)) - return error("BUG: expected exactly one commit from walk"); + if (!cmit) + return error(_("empty commit set passed")); + if (get_revision(opts->revs)) + BUG("unexpected extra commit from walk"); return single_pick(cmit, opts); } |