Re: [PATCH 1/2] t3507: pin CHERRY_PICK_HEAD absence for a conflicting --no-commit
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Sep 4, 2026, 09:53 UTC
- Message-ID
- <5a5c7552-8fc8-48be-abf6-063aa31f7711@gmail.com>
- In-Reply-To
- <xmqq7bl29g2p.fsf@gitster.g>
On 03/09/2026 22:32, Junio C Hamano wrote:
Show 13 quoted lines
> Aleksei Sviridkin <f@lex.la> writes: > > I shamelessly asked an AI agent I had nearby to guess what your log > message might have meant and got the following. I am not sure if > that matches what you wanted to say, or if it is totally off the > mark, but at least I can follow what it is trying to say, even > though I do not think if that matches reality (for example, when > "--no-commit" is in effect, we probably do not want CHERRY_PICK_HEAD, > even though the version of the text given by Gemini below claims it > is needed). > > When a cherry-pick is run with the --no-commit option and halts > due to conflicts, Git must still write the CHERRY_PICK_HEAD ref.
No, with --no-commit it must not write CHERRY_PICK_HEAD. I agree the commit message is confusing and could be much shorter.
Thanks
Phillip > This ref is necessary because a subsequent "git commit" relies
Show 43 quoted lines
> on it to preserve the authorship metadata of the original > commit. > > Add a new test alongside the existing cherry-pick tests to > verify this behavior. The test suite currently checks for > CHERRY_PICK_HEAD after a conflicting pick, after a clean pick, > and after a clean pick with --no-commit. However, it lacks > coverage for a conflicting pick with --no-commit. Indeed, if > Git is modified to stop writing the ref in this specific > scenario, all existing tests still pass. This new test closes > the coverage gap. > > > > > >> >> Assisted-by: LLM >> Signed-off-by: Aleksei Sviridkin <f@lex.la> >> --- >> t/t3507-cherry-pick-conflict.sh | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh >> index 44596cb1e8..2ce2e88184 100755 >> --- a/t/t3507-cherry-pick-conflict.sh >> +++ b/t/t3507-cherry-pick-conflict.sh >> @@ -100,6 +100,12 @@ test_expect_success 'cherry-pick --no-commit does not set CHERRY_PICK_HEAD' ' >> test_must_fail git rev-parse --verify CHERRY_PICK_HEAD >> ' >> >> +test_expect_success 'failed cherry-pick --no-commit does not set CHERRY_PICK_HEAD' ' >> + pristine_detach initial && >> + test_must_fail git cherry-pick --no-commit picked && >> + test_must_fail git rev-parse --verify CHERRY_PICK_HEAD >> +' >> + >> test_expect_success 'cherry-pick w/dirty tree does not set CHERRY_PICK_HEAD' ' >> pristine_detach initial && >> echo foo >foo && >> >> base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc >