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

Re: [RFC] sequencer: allow metadata to be saved if using cherry-pick --no-commit

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 21, 2020, 16:12 UTC
Message-ID
<20201021161242.GA111581@nand.local>
In-Reply-To
<20201021062430.2029566-1-eantoranz@gmail.com>
Hi Edmundo,
On Wed, Oct 21, 2020 at 12:24:30AM -0600, Edmundo Carmona Antoranz wrote:
Show 5 quoted lines
> Currently, if 'git cherry-pick --no-commit' is run _and the cherry-pick
> operation is successful_, the metadata from the original revision is lost and
> to git it's like a cherry-pick operation is not taking place at all. Hence,
> we can't wrap up the cherry-pick operation by calling
> 'git cherry-pick --continue'.
Interesting.
Show 18 quoted lines
> diff --git a/sequencer.c b/sequencer.c
> index 00acb12496..c1ccbe0faf 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -2022,9 +2022,8 @@ static int do_pick_commit(struct repository *r,
>  	 * However, if the merge did not even start, then we don't want to
>  	 * write it at all.
>  	 */
> -	if ((command == TODO_PICK || command == TODO_REWORD ||
> -	     command == TODO_EDIT) && !opts->no_commit &&
> -	    (res == 0 || res == 1) &&
> +	if ((command == TODO_PICK || command == TODO_REWORD || command == TODO_EDIT)
> +		&& ((res == 0 && opts->no_commit) || (res == 1 && !opts->no_commit)) &&
>  	    update_ref(NULL, "CHERRY_PICK_HEAD", &commit->object.oid, NULL,
>  		       REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR))
>  		res = -1;
> --
> 2.28.0

Hmm. I'm a little confused after reading your patch below. Why does (res == 0) change to (res == 0 && opts->no_commit)? Wouldn't we still want to update our CHERRY_PICK_HEAD even if "res == 0 && !opts->no_commit"?

Even still, this patch as it is seems to fail a number of tests. You can run the tests yourself by running "make && make test", and there is more information about that in t/README.

Thanks, Taylor

Previous: Edmundo Carmona AntoranzNext: Edmundo Carmona Antoranz
Message 3 of 8 in “[RFC] sequencer: allow metadata to be saved if using cherry-pick --no-commit”
  1. Edmundo Carmona AntoranzOct 21, 2020
  2. Edmundo Carmona AntoranzOct 21, 2020
  3. Taylor BlauOct 21, 2020
  4. Edmundo Carmona AntoranzOct 21, 2020
  5. Junio C HamanoOct 21, 2020
  6. Junio C HamanoOct 21, 2020
  7. Edmundo Carmona AntoranzOct 21, 2020
  8. Edmundo Carmona AntoranzOct 21, 2020

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.