diff options
-rw-r--r-- | builtin/revert.c | 2 | ||||
-rw-r--r-- | sequencer.c | 6 | ||||
-rwxr-xr-x | t/t3508-cherry-pick-many-commits.sh | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index 42ce399d88..98ad6410ab 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -193,7 +193,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) struct setup_revision_opt s_r_opt; opts->revs = xmalloc(sizeof(*opts->revs)); init_revisions(opts->revs, NULL); - opts->revs->no_walk = REVISION_WALK_NO_WALK_SORTED; + opts->revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED; if (argc < 2) usage_with_options(usage_str, options); memset(&s_r_opt, 0, sizeof(s_r_opt)); diff --git a/sequencer.c b/sequencer.c index bf078f274b..bd626806d6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -543,7 +543,11 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) static void prepare_revs(struct replay_opts *opts) { - if (opts->action != REPLAY_REVERT) + /* + * picking (but not reverting) ranges (but not individual revisions) + * should be done in reverse + */ + if (opts->action == REPLAY_PICK && !opts->revs->no_walk) opts->revs->reverse ^= 1; if (prepare_revision_walk(opts->revs)) diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh index afda2d5825..340afc760d 100755 --- a/t/t3508-cherry-pick-many-commits.sh +++ b/t/t3508-cherry-pick-many-commits.sh @@ -44,7 +44,7 @@ test_expect_success 'cherry-pick first..fourth works' ' check_head_differs_from fourth ' -test_expect_failure 'cherry-pick three one two works' ' +test_expect_success 'cherry-pick three one two works' ' git checkout -f first && test_commit one && test_commit two && |