From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Christian Couder" <chriscool@tuxfamily.org>,
"Jonathan Nieder" <jrnieder@gmail.com>
Subject: Re: [PATCH] cherry-pick: don't barf when there's nothing to do
Date: Mon, 03 Jun 2013 16:20:27 -0700 [thread overview]
Message-ID: <7vtxlebx38.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1369921781-30667-1-git-send-email-felipe.contreras@gmail.com
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"));
> }
prev parent reply other threads:[~2013-06-03 23:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vtxlebx38.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).