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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 29, 2021, 20:56 UTC
Message-ID
<xmqqzgu43kkz.fsf@gitster.g>
In-Reply-To
<5c5ec310b9230ee19bde4b3c8733b359d5218b32.1627561665.git.gitgitgadget@gmail.com>
"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> -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).

Previous: ZheNing Hu via GitGitGadgetNext: ZheNing Hu
Message 4 of 5 in “[GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP”
  1. 0/2 [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELPZheNing Hu via GitGitGadget, Jul 29, 2021
  2. 2/2 [GSOC] cherry-pick: use better advice messageZheNing Hu via GitGitGadget, Jul 29, 2021
  3. 1/2 [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELPZheNing Hu via GitGitGadget, Jul 29, 2021
  4. Junio C HamanoJul 29, 2021
  5. ZheNing HuJul 30, 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.