From: "Son Luong Ngoc via GitGitGadget" <gitgitgadget@gmail•com>
To: git@vger•kernel.org
Cc: Son Luong Ngoc <sluongng@gmail•com>, Son Luong Ngoc <sluongng@gmail•com>
Subject: [PATCH 1/2] t3404: add failing branch symref test
Date: Thu, 28 May 2026 05:42:00 +0000 [thread overview]
Message-ID: <a550923440a233daea0b9819e05d6c380de00d09.1779946921.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2126.git.1779946921.gitgitgadget@gmail.com>
From: Son Luong Ngoc <sluongng@gmail•com>
rebase --update-refs queues local branch decorations by their literal
refnames. When a branch such as refs/heads/main is a symbolic ref to
the current branch, the normal rebase path first updates the current
branch and the queued symref update later tries to update the same
referent with the old value it recorded before the rebase.
Add a known-breakage test that exercises this case so that the fix can
flip it to test_expect_success. The expected behavior is that the branch
symref keeps pointing at the rebased current branch.
Signed-off-by: Son Luong Ngoc <sluongng@gmail•com>
---
t/t3404-rebase-interactive.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 58b3bb0c27..42ba8cc313 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1978,6 +1978,31 @@ test_expect_success '--update-refs ignores non-branch decorations' '
test_cmp expect actual
'
+test_expect_failure '--update-refs skips branch symrefs to current branch' '
+ test_when_finished "
+ test_might_fail git rebase --abort &&
+ git checkout primary &&
+ test_might_fail git symbolic-ref -d refs/heads/update-refs-symref-alias &&
+ test_might_fail git branch -D update-refs-symref update-refs-symref-base
+ " &&
+ git checkout -B update-refs-symref-base primary &&
+ test_commit --no-tag update-refs-symref-base symref-base.t &&
+ git checkout -B update-refs-symref &&
+ test_commit --no-tag update-refs-symref-topic symref-topic.t &&
+ git checkout update-refs-symref-base &&
+ test_commit --no-tag update-refs-symref-newbase symref-newbase.t &&
+ git checkout update-refs-symref &&
+ git symbolic-ref refs/heads/update-refs-symref-alias refs/heads/update-refs-symref &&
+
+ git rebase --update-refs update-refs-symref-base 2>err &&
+
+ test_cmp_rev update-refs-symref-base update-refs-symref^ &&
+ test_cmp_rev refs/heads/update-refs-symref refs/heads/update-refs-symref-alias &&
+ test_write_lines refs/heads/update-refs-symref >expect &&
+ git symbolic-ref refs/heads/update-refs-symref-alias >actual &&
+ test_cmp expect actual
+'
+
test_expect_success '--update-refs updates refs correctly' '
git checkout -B update-refs no-conflict-branch &&
git branch -f base HEAD~4 &&
--
gitgitgadget
next prev parent reply other threads:[~2026-05-28 5:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 5:41 [PATCH 0/2] rebase: handle --update-refs branch symrefs Son Luong Ngoc via GitGitGadget
2026-05-28 5:42 ` Son Luong Ngoc via GitGitGadget [this message]
2026-06-01 13:52 ` [PATCH 1/2] t3404: add failing branch symref test Phillip Wood
2026-05-28 5:42 ` [PATCH 2/2] rebase: skip branch symref aliases Son Luong Ngoc via GitGitGadget
2026-05-28 7:08 ` Kristoffer Haugsbakk
2026-06-01 14:10 ` Phillip Wood
2026-05-28 20:42 ` [PATCH 0/2] rebase: handle --update-refs branch symrefs Junio C Hamano
2026-06-03 10:27 ` [PATCH v2] rebase: skip branch symref aliases Son Luong Ngoc via GitGitGadget
2026-06-04 15:37 ` Phillip Wood
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=a550923440a233daea0b9819e05d6c380de00d09.1779946921.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sluongng@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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