All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
Cc: 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>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	"ZheNing Hu" <adlternative@gmail.com>
Subject: Re: [PATCH 1/2] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP
Date: Thu, 29 Jul 2021 13:56:44 -0700	[thread overview]
Message-ID: <xmqqzgu43kkz.fsf@gitster.g> (raw)
In-Reply-To: <5c5ec310b9230ee19bde4b3c8733b359d5218b32.1627561665.git.gitgitgadget@gmail.com> (ZheNing Hu via GitGitGadget's message of "Thu, 29 Jul 2021 12:27:43 +0000")

"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:

> -static void print_advice(struct repository *r, int show_hint,
> -			 struct replay_opts *opts)
> +static char *check_need_delete_cherry_pick_head(struct repository *r)
>  {
>  	char *msg = getenv("GIT_CHERRY_PICK_HELP");
>  
>  	if (msg) {
> -		fprintf(stderr, "%s\n", msg);
>  		/*
>  		 * A conflict has occurred but the porcelain
>  		 * (typically rebase --interactive) wants to take care
> @@ -411,18 +409,22 @@ static void print_advice(struct repository *r, int show_hint,
>  		 */
>  		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
>  				NULL, 0);
> -		return;
> +		return msg;
>  	}
> +	return NULL;
> +}

The patch is a bit hard to read, but I do not think this improves
the root cause of the issue at all, which is that "do we need to
delete the pseudoref?" decision is tied to and based on the presense
of the custom message in the environment variable.

The original issue was that we declared (erroneously) that the
presence of a custom message _means_ the caller is not a human but a
sequencing machinery that wants to deal with what is done via the
CHERRY_PICK_HEAD pseudoref itself, and your original issue was that
when a human user has the custom message envirnoment (either on
purpose or by mistake), the logic _misidentifies_ the call as if it
is made from a sequencing machinery and we lose the CHERRY_PICK_HEAD
pseudoref.  The root cause is mistaking the correlation (sequencing
machinery uses the environment and it also does not want pseudoref)
as the causation (presense of the environment means we should remove
pseudoref).

  reply	other threads:[~2021-07-29 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 12:27 [PATCH 0/2] " ZheNing Hu via GitGitGadget
2021-07-29 12:27 ` [PATCH 1/2] " ZheNing Hu via GitGitGadget
2021-07-29 20:56   ` Junio C Hamano [this message]
2021-07-30 14:15     ` ZheNing Hu
2021-07-29 12:27 ` [PATCH 2/2] [GSOC] cherry-pick: use better advice message ZheNing Hu via GitGitGadget
2021-07-31  7:01 [PATCH 0/2] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP ZheNing Hu via GitGitGadget
2021-07-31  7:01 ` [PATCH 1/2] " ZheNing Hu via GitGitGadget
2021-08-01 10:09   ` Phillip Wood
2021-08-02 13:34     ` ZheNing Hu

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzgu43kkz.fsf@gitster.g \
    --to=gitster@pobox.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=hanwen@google.com \
    --cc=hariom18599@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --subject='Re: [PATCH 1/2] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.