git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP

From
ZheNing Hu <adlternative@gmail.com>
Date
Jul 23, 2021, 09:37 UTC
Message-ID
<CAOLTT8Ty47fyY7T3d68CYPKh9k+HAHsnCLJ=F0KaLm+0gp3+EQ@mail.gmail.com>
In-Reply-To
<xmqqo8au82i0.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年7月23日周五 上午5:25写道:
Show 14 quoted lines
>
> "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
Show 9 quoted lines
> 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

Previous: Junio C HamanoNext: Felipe Contreras
Message 3 of 17 in “[GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP”
  1. [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELPZheNing Hu via GitGitGadget, Jul 22, 2021
  2. Junio C HamanoJul 22, 2021
  3. ZheNing HuJul 23, 2021
  4. Felipe ContrerasJul 23, 2021
  5. [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELPZheNing Hu via GitGitGadget, Jul 24, 2021
  6. Phillip WoodJul 27, 2021
  7. Junio C HamanoJul 27, 2021
  8. Junio C HamanoJul 27, 2021
  9. Phillip WoodJul 28, 2021
  10. ZheNing HuJul 28, 2021
  11. Junio C HamanoJul 28, 2021
  12. ZheNing HuJul 28, 2021
  13. Junio C HamanoJul 28, 2021
  14. ZheNing HuJul 28, 2021
  15. Phillip WoodJul 28, 2021
  16. ZheNing HuJul 28, 2021
  17. Phillip WoodJul 28, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.