git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edmundo Carmona Antoranz <eantoranz@gmail.com>
To: git@vger.kernel.org
Cc: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Subject: [RFC] sequencer: allow metadata to be saved if using cherry-pick --no-commit
Date: Wed, 21 Oct 2020 00:24:30 -0600	[thread overview]
Message-ID: <20201021062430.2029566-1-eantoranz@gmail.com> (raw)

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'.

With this patch, we allow sequencer to save the metadata from the original
cherry-pick operation so that 'git cherry-pick --continue' can be called.

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 sequencer.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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


             reply	other threads:[~2020-10-21  6:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  6:24 Edmundo Carmona Antoranz [this message]
2020-10-21  6:31 ` [RFC] sequencer: allow metadata to be saved if using cherry-pick --no-commit Edmundo Carmona Antoranz
2020-10-21 16:12 ` Taylor Blau
2020-10-21 18:04   ` Edmundo Carmona Antoranz
2020-10-21 19:46 ` Junio C Hamano
2020-10-21 20:41   ` Junio C Hamano
2020-10-21 20:45   ` Edmundo Carmona Antoranz
2020-10-21 20:53     ` Edmundo Carmona Antoranz

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=20201021062430.2029566-1-eantoranz@gmail.com \
    --to=eantoranz@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).