git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] cherry-pick: don't barf when there's nothing to do
@ 2013-05-30 13:49 Felipe Contreras
  2013-06-03 23:20 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Felipe Contreras @ 2013-05-30 13:49 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Christian Couder, Jonathan Nieder, Felipe Contreras

If the user set --ff, it's expected that if theres's nothing to do we
fast-forward our current HEAD, which is a no-op.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index d8f9d30..b9d4b48 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -749,7 +749,7 @@ static void prepare_revs(struct replay_opts *opts)
 	if (prepare_revision_walk(opts->revs))
 		die(_("revision walk setup failed"));
 
-	if (!opts->revs->commits)
+	if (!opts->revs->commits && !opts->allow_ff)
 		die(_("empty commit set passed"));
 }
 
-- 
1.8.3.rc3.312.g47657de

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cherry-pick: don't barf when there's nothing to do
  2013-05-30 13:49 [PATCH] cherry-pick: don't barf when there's nothing to do Felipe Contreras
@ 2013-06-03 23:20 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-06-03 23:20 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: git, Ævar Arnfjörð Bjarmason, Christian Couder,
	Jonathan Nieder

Felipe Contreras <felipe.contreras@gmail.com> writes:

> If the user set --ff, it's expected that if theres's nothing to do we
> fast-forward our current HEAD, which is a no-op.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---

This is about "git cherry-pick topic..master" which is a misspelt
form of "git cherry-pick master..topic", or alternatively, a script
calling "git cherry-pick ..$branch" that turns out to be giving an
empty set, isn't it?

I suspect that it is perfectly fine to turn this die() into a
warning or an informational feedback (or be silent when --quiet is
given) and make the command exit with success.  If the user asked
for a no-op, the result should be a no-op, but because a no-op is a
strange thing to ask for, and is deserved to be warned about.

But I do not see why we should behave differently between with and
without --ff option.

I also notice this funkiness with "--ff":

	git.git/master$ git checkout master^
        git.git/(ed73fe5...)$ git cherry-pick master^0
        [detached HEAD 32af3ed] Update draft release notes to 1.8.4
	 1 file changed, 53 insertions(+)
	git.git/(32af3ed...)$ git checkout master^
        git.git/(ed73fe5...)$ git cherry-pick --ff master^0
        git.git/(b2edae0...)$

The last cherry-pick shows nothing.  The user can notice that
something useful has happened only because git-prompt script is in
use (and he is experimenting on a detached HEAD), but otherwise
there is no feedback.  I think it should, unless given --quiet, say
something like "fast-forwarded to ..." to avoid user confusion.

>  sequencer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index d8f9d30..b9d4b48 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -749,7 +749,7 @@ static void prepare_revs(struct replay_opts *opts)
>  	if (prepare_revision_walk(opts->revs))
>  		die(_("revision walk setup failed"));
>  
> -	if (!opts->revs->commits)
> +	if (!opts->revs->commits && !opts->allow_ff)
>  		die(_("empty commit set passed"));
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-03 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 13:49 [PATCH] cherry-pick: don't barf when there's nothing to do Felipe Contreras
2013-06-03 23:20 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).