From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>,
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>,
"Felipe Contreras" <felipe.contreras@gmail.com>,
"ZheNing Hu" <adlternative@gmail.com>
Subject: Re: [PATCH v2] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP
Date: Wed, 28 Jul 2021 10:56:09 +0100 [thread overview]
Message-ID: <e5c6d620-6c02-8824-741a-4136081edd02@gmail.com> (raw)
In-Reply-To: <xmqqtukfcvzv.fsf@gitster.g>
On 27/07/2021 22:00, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>> This will break git-rebase--preserve-merges.sh which uses
>>> GIT_CHERRY_PICK_HELP to set the help and ensure CHERRY_PICK_HEAD is
>>> removed when picking commits.
>>
>> Ahh, I didn't realize we still had scripted rebase backends that
>> called cherry-pick as an executable. I was hoping that all rebase
>> backends by now would be calling into the cherry-pick machinery
>> directly, bypassing cmd_cherry_pick(), and that was why I suggested
>> to catch stray one the end-users set manually in the environment
>> and clear it there.
>>
>>> I'm a bit confused as to what the
>>> problem is - how is 'git cherry-pick' being run with
>>> GIT_CHERRY_PICK_HELP set in the environment outside of a rebase (your
>>> explanation in [1] does not mention how GIT_CHERRY_PICK_HELP is set)?
>>
>> I didn't press for the information too hard, but I guessed that it
>> was perhaps because somebody like stackoverflow suggested to set a
>> message in their environment to get a "better message."
>
> A good way forward may be to relieve sequencer.c::print_advice() of
> the responsibility of optinally removing CHERRY_PICK_HEAD; make it a
> separate function that bases its decision on a more direct cue, not
> on the presense of a custom message in GIT_CHERRY_PICK_HELP, make
> do_pick_commit(), which is the sole caller of print_advice(), call
> it after calling print_advice().
>
> I do not offhand know what that "direct cue" should be, but we may
> already have an appropriate field in the replay_opts structure;
> "replay.action is neither REVERT nor PICK" could be a good enough
> approximation, I dunno.
>
> Otherwise we can allocate a new bit in the structure, have relevant
> callers set it, and teach cherry-pick an unadvertised command line
> option that sets the bit, and use that option only from
> git-rebase--preserve-merges when it makes a call to cherry-pick.
> When "rebase -p" is either retired or rewritten in C, we can retire
> the option from cherry-pick.
>
> Workable?
Most of the time the builtin rebase should not be writing
CHERRY_PICK_HEAD in the first place (it needs it when a commit becomes
empty but not otherwise). For 'rebase -p' adding a command line option
to cherry-pick as you suggest is probably the cleanest solution - in the
short term 'rebase -i' could set it until we refactor the code that
creates CHERRY_PICK_HEAD. One thing to note is that I think
GIT_CHERRY_PICK_HELP was introduced to allow assist scripted rebase like
porcelains rather than as a way to allow users to customize the help and
setting it has always removed CHERRY_PICK_HEAD. There are however no
users of GIT_CHERRY_PICK_HELP on codesearch.debian.org
Best Wishes
Phillip
next prev parent reply other threads:[~2021-07-28 9:56 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
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 [this message]
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=e5c6d620-6c02-8824-741a-4136081edd02@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=adlternative@gmail.com \
--cc=artagnon@gmail.com \
--cc=avarab@gmail.com \
--cc=christian.couder@gmail.com \
--cc=felipe.contreras@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).