From: Phillip Wood <phillip.wood123@gmail.com>
To: Vegard Nossum <vegard.nossum@oracle.com>, gitster@pobox.com
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Subject: Re: [PATCH] t/t3515-cherry-pick-rebase.sh: new testcase demonstrating broken behavior
Date: Sun, 4 Feb 2024 11:14:55 +0000 [thread overview]
Message-ID: <0adb1068-ef10-44ed-ad1d-e0927a09245d@gmail.com> (raw)
In-Reply-To: <20240202091850.160203-1-vegard.nossum@oracle.com>
Hi Vegard
On 02/02/2024 09:18, Vegard Nossum wrote:
> Running "git cherry-pick" as an x-command in the rebase plan loses the
> original authorship information.
>
> Write a known-broken test case for this:
>
> $ (cd t && ./t3515-cherry-pick-rebase.sh)
> ok 1 - setup
> ok 2 - cherry-pick preserves authorship information
> not ok 3 - cherry-pick inside rebase preserves authorship information # TODO known breakage
> # still have 1 known breakage(s)
> # passed all remaining 2 test(s)
> 1..3
>
> Running with --verbose we see the diff between expected and actual:
>
> --- expected 2024-02-02 08:54:48.954753285 +0000
> +++ actual 2024-02-02 08:54:48.966753294 +0000
> @@ -1 +1 @@
> -Original Author
> +A U Thor
>
> As far as I can tell, this is due to the check in print_advice()
> which deletes CHERRY_PICK_HEAD when GIT_CHERRY_PICK_HELP is set,
> but I'm not sure what a good fix would be.
Thanks for reporting this and for the test case. I agree with your
diagnosis. I think the simplest fix would be to unset
GIT_CHERRY_PICK_HELP in the child environment in sequencer.c:do_exec().
Long term we should stop setting GIT_CHERRY_PICK_HELP when rebasing and
hard code the rebase conflicts message in sequencer.c as the environment
variable is a vestige of the scripted rebase implementation.
To work around the bug I think you can change the exec lines in the todo
list to
exec unset GIT_CHERRY_PICK_HELP; git cherry-pick ...
Best Wishes
Phillip
> Cc: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
> t/t3515-cherry-pick-rebase.sh | 37 +++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
> create mode 100755 t/t3515-cherry-pick-rebase.sh
>
> diff --git a/t/t3515-cherry-pick-rebase.sh b/t/t3515-cherry-pick-rebase.sh
> new file mode 100755
> index 0000000000..ffe6f5fe2a
> --- /dev/null
> +++ b/t/t3515-cherry-pick-rebase.sh
> @@ -0,0 +1,37 @@
> +#!/bin/sh
> +
> +test_description='test cherry-pick during a rebase'
> +
> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
> +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> +
> +. ./test-lib.sh
> +
> +test_expect_success setup '
> + test_commit --author "Original Author <original.author@example.com>" foo file contents1 &&
> + git checkout -b feature &&
> + test_commit --author "Another Author <another.author@example.com>" bar file contents2
> +'
> +
> +test_expect_success 'cherry-pick preserves authorship information' '
> + git checkout -B tmp feature &&
> + test_must_fail git cherry-pick foo &&
> + git add file &&
> + git commit --no-edit &&
> + git log -1 --format='%an' foo >expected &&
> + git log -1 --format='%an' >actual &&
> + test_cmp expected actual
> +'
> +
> +test_expect_failure '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 &&
> + git add file &&
> + git commit --no-edit &&
> + git log -1 --format='%an' foo >expected &&
> + git log -1 --format='%an' >actual &&
> + test_cmp expected actual
> +'
> +
> +test_done
next prev parent reply other threads:[~2024-02-04 11:14 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 [this message]
2024-02-05 14:13 ` [PATCH 2/2] sequencer: unset GIT_CHERRY_PICK_HELP for 'exec' commands Vegard Nossum
2024-02-05 14:38 ` 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=0adb1068-ef10-44ed-ad1d-e0927a09245d@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=jrnieder@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=vegard.nossum@oracle.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.