summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sequencer.c6
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh7
2 files changed, 10 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index 4d3f605..7fbacc1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1176,8 +1176,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;
}
@@ -1560,6 +1558,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;
}
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 0acf4b1..6987bbf 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -480,11 +480,16 @@ test_expect_success 'malformed instruction sheet 2' '
test_expect_code 128 git cherry-pick --continue
'
-test_expect_success 'empty commit set' '
+test_expect_success 'empty commit set (no commits to walk)' '
pristine_detach initial &&
test_expect_code 128 git cherry-pick base..base
'
+test_expect_success 'empty commit set (culled during walk)' '
+ pristine_detach initial &&
+ test_expect_code 128 git cherry-pick -2 --author=no.such.author base
+'
+
test_expect_success 'malformed instruction sheet 3' '
pristine_detach initial &&
test_expect_code 1 git cherry-pick base..anotherpick &&