git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: ZheNing Hu <adlternative@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>,
	"Git List" <git@vger.kernel.org>,
	"Christian Couder" <christian.couder@gmail.com>,
	"Hariom Verma" <hariom18599@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Han-Wen Nienhuys" <hanwen@google.com>,
	"Ramkumar Ramachandra" <artagnon@gmail.com>
Subject: Re: [PATCH] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP
Date: Fri, 23 Jul 2021 17:37:42 +0800	[thread overview]
Message-ID: <CAOLTT8Ty47fyY7T3d68CYPKh9k+HAHsnCLJ=F0KaLm+0gp3+EQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqo8au82i0.fsf@gitster.g>

Junio C Hamano <gitster@pobox.com> 于2021年7月23日周五 上午5:25写道:
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: ZheNing Hu <adlternative@gmail.com>
> >
> > If we set the value of the environment variable GIT_CHERRY_PICK_HELP
> > when using `git cherry-pick`, CHERRY_PICK_HEAD will be deleted, then
> > we will get an error when we try to use `git cherry-pick --continue`
> > or other cherr-pick command.
>
> I think that the GIT_CHERRY_PICK_HELP is an implemention detail for
> various forms of rebase to use cherry-pick as a backend and not for
> use by end users.
>

But someone complain to me that the cherry-pick advice is not good enough.
Think about a git newbie is cherry-picking a patch series containing
several commits,
E.g.

git cherry-pick dev~3..dev

And then he (she) will see these advice info:
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

After he resolving git conflict, execute 'git commit' according to the
prompt, A terrible thing happened: CHERRY_PICK_HEAD is deleted
by git and no errors are output. But in fact .git/sequencer still exists,
Wait until he uses the cherry-pick command next time, the error appears:

error: cherry-pick is already in progress
hint: try "git cherry-pick (--continue | --abort | --quit)"
fatal: cherry-pick failed

So we should not encourage users to use git commit when git cherry-pick.
It would be great if it could provide advice similar to rebase, like this:

Once you are satisfied with your changes, run

  git cherry-pick --continue

> I strongly suspect that the right solution for the breakage is to
> unsetenv(GIT_CHERRY_PICK_HELP) in cmd_cherry_pick() without touching
> sequencer.c at all.
>
> It _is_ ugly that a helper that is responsible for emitting an
> advise message also makes a decision whether the pseudo-ref gets
> deleted or not, but a fix to that problem should be done byy making
> the logic for the decision less complex, not more.
>

May be you are right :)

> So, I am not enthused to see this change.

Thanks.
--
ZheNing Hu

  reply	other threads:[~2021-07-23  9:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 14:06 [PATCH] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP ZheNing Hu via GitGitGadget
2021-07-22 21:25 ` Junio C Hamano
2021-07-23  9:37   ` ZheNing Hu [this message]
2021-07-23 17:01     ` Felipe Contreras
2021-07-24 14:01 ` [PATCH v2] " ZheNing Hu via GitGitGadget
2021-07-27 19:43   ` Phillip Wood
2021-07-27 20:44     ` Junio C Hamano
2021-07-27 21:00       ` Junio C Hamano
2021-07-28  9:56         ` Phillip Wood
2021-07-28 10:56         ` ZheNing Hu
2021-07-28 17:24           ` Junio C Hamano
2021-07-28 11:34         ` ZheNing Hu
2021-07-28 17:26           ` Junio C Hamano
2021-07-28  7:39     ` ZheNing Hu
2021-07-28  9:46       ` Phillip Wood
2021-07-28 11:01         ` ZheNing Hu
2021-07-28 16:52           ` Phillip Wood

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='CAOLTT8Ty47fyY7T3d68CYPKh9k+HAHsnCLJ=F0KaLm+0gp3+EQ@mail.gmail.com' \
    --to=adlternative@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=hanwen@google.com \
    --cc=hariom18599@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).