Subject: Re: [PATCH 4/7] revert: allow single-pick in the middle of cherry-pick sequence

From: Jonathan Nieder <[email-masked]>
Date: Thu, 5 Apr 2012 07:15:08 -0500

Ævar Arnfjörð Bjarmason wrote:

> This might be an issue introduced later in Ramkumar's code when he
> moved this around, but on git.git's e5056c0 I get this:
>
>     $ ./git revert --author=Ævar :/i18n
>     fatal: BUG: expected exactly one commit from walk

This seems buggy on two counts:

 1. The ":/" magic should probably imply --do-walk so that

	git show --author=Ævar :/i18n

    does the right thing.

 2.

	$ git cherry-pick --author=Ævar origin/pu
	fatal: BUG: expected exactly one commit from walk

   The single-pick code does not understand that such a
   simple revision specifier can return no revisions.  A more
   appropriate error message would be

	fatal: empty commit set passed

diff --git i/sequencer.c w/sequencer.c
index a37846a5..736ccd57 100644
--- i/sequencer.c
+++ w/sequencer.c
@@ -908,7 +908,10 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 		if (prepare_revision_walk(opts->revs))
 			die(_("revision walk setup failed"));
 		cmit = get_revision(opts->revs);
-		if (!cmit || get_revision(opts->revs))
+		if (!cmit)
+			/* e.g. "git cherry-pick --author=nobody <commit>" */
+			die(_("empty commit set passed"));
+		if (get_revision(opts->revs))
 			die("BUG: expected exactly one commit from walk");
 		return single_pick(cmit, opts);
 	}