All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Phillip Wood <phillip.wood123@gmail.com>
Subject: [PATCH 2/2] sequencer: unset GIT_CHERRY_PICK_HELP for 'exec' commands
Date: Mon,  5 Feb 2024 15:13:35 +0100	[thread overview]
Message-ID: <20240205141335.762947-1-vegard.nossum@oracle.com> (raw)
In-Reply-To: <0adb1068-ef10-44ed-ad1d-e0927a09245d@gmail.com>

Running "git cherry-pick" as an x-command in the rebase plan loses the
original authorship information.

To fix this, unset GIT_CHERRY_PICK_HELP for 'exec' commands.

Link: https://lore.kernel.org/git/0adb1068-ef10-44ed-ad1d-e0927a09245d@gmail.com/
Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 sequencer.c                   | 1 +
 t/t3515-cherry-pick-rebase.sh | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index 91de546b32..f49a871ac0 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3641,6 +3641,7 @@ static int do_exec(struct repository *r, const char *command_line)
 	fprintf(stderr, _("Executing: %s\n"), command_line);
 	cmd.use_shell = 1;
 	strvec_push(&cmd.args, command_line);
+	strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
 	status = run_command(&cmd);
 
 	/* force re-reading of the cache */
diff --git a/t/t3515-cherry-pick-rebase.sh b/t/t3515-cherry-pick-rebase.sh
index ffe6f5fe2a..5cb2b96f66 100755
--- a/t/t3515-cherry-pick-rebase.sh
+++ b/t/t3515-cherry-pick-rebase.sh
@@ -23,7 +23,7 @@ test_expect_success 'cherry-pick preserves authorship information' '
 	test_cmp expected actual
 '
 
-test_expect_failure 'cherry-pick inside rebase preserves authorship information' '
+test_expect_success 'cherry-pick inside rebase preserves authorship information' '
 	git checkout -B tmp feature &&
 	echo "x git cherry-pick -x foo" >rebase-plan &&
 	test_must_fail env GIT_SEQUENCE_EDITOR="cp rebase-plan" git rebase -i feature &&
-- 
2.34.1


  reply	other threads:[~2024-02-05 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  9:18 [PATCH] t/t3515-cherry-pick-rebase.sh: new testcase demonstrating broken behavior Vegard Nossum
2024-02-04 11:14 ` Phillip Wood
2024-02-05 14:13   ` Vegard Nossum [this message]
2024-02-05 14:38     ` [PATCH 2/2] sequencer: unset GIT_CHERRY_PICK_HELP for 'exec' commands Kristoffer Haugsbakk
2024-02-05 23:09       ` Junio C Hamano
2024-02-05 23:14         ` Vegard Nossum
2024-02-06  3:54           ` Junio C Hamano
2024-02-07 14:03             ` Phillip Wood
2024-02-07 16:39               ` Junio C Hamano
2024-02-08  8:48                 ` Vegard Nossum
2024-02-08 14:26                   ` Phillip Wood
2024-02-08 17:20                     ` Junio C Hamano
2024-02-11 11:11                       ` Phillip Wood
2024-02-11 17:05                         ` Junio C Hamano
2024-02-15 14:24                           ` Vegard Nossum
2024-02-15 17:36                             ` Junio C Hamano

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=20240205141335.762947-1-vegard.nossum@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=phillip.wood123@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.
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.