Re: [PATCH 1/2] t3404: add failing branch symref test
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jun 1, 2026, 13:52 UTC
- Message-ID
- <67e1a735-4f7b-476a-8841-09649290dd51@gmail.com>
- In-Reply-To
- <a550923440a233daea0b9819e05d6c380de00d09.1779946921.git.gitgitgadget@gmail.com>
On 28/05/2026 06:42, Son Luong Ngoc via GitGitGadget wrote:
Show 11 quoted lines
> 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.
Thanks for adding a test, I'd find it easier to review this series if the test was added in the same patch as the fix which is our usual practice.
Show 15 quoted lines
> +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 &&
I think we want to test a symref that does not match HEAD as well. Rather than adding a new test, can we instead add a couple of symref branches to the test "--update-refs updates refs correctly"?
Thanks
Phillip
Show 13 quoted lines
> + > + 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 &&