From: Erik Cervin-Edin <erik@cervined.in>
To: phillip.wood@dunelm.org.uk
Cc: Son Luong Ngoc via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Son Luong Ngoc <sluongng@gmail.com>
Subject: Re: [PATCH v3 1/2] rebase: skip branch symref aliases
Date: Sat, 25 Jul 2026 13:21:53 +0200 [thread overview]
Message-ID: <amSSYagL0jTgzElD@mbp> (raw)
In-Reply-To: <00e529b6-7ae7-463f-a4b3-0991e9411aba@gmail.com>
I ran into a minor regression that I tracked down to v2 of this patch
series. When I was running
git rebase --interactive --update-refs
I got a comment in my git-rebase-todo for the branch I was rebasing,
even though it's just the current branch in the current worktree:
# Ref refs/heads/main checked out at '/private/tmp/gittest'
where I'd expect no entry at all, since the branch is updated by the
rebase itself. After applying v3 of the series, the regression went
away. Nevertheless, I thought I ought to share what I found.
On 26/07/24 10:55AM, Phillip Wood wrote:
> > > + if (head_ref && !strcmp(head_ref, decoration->name)) {
> > > + free(resolved_ref);
> > > decoration = decoration->next;
> > > continue;
> > > }
> > > +
> > > + path = branch_checked_out(decoration->name);
> >
> > Then we check to see if the decoration matches HEAD which we used to do
> > above - I'm not clear why we have moved this check.
branch_checked_out() can't tell "checked out in another worktree"
apart from "checked out right here", so `path` is never NULL for the
branch actually being rebased. In v2, the check above was instead:
if (!path && head_ref && !strcmp(head_ref, decoration->name))
continue;
which made it a no-op for exactly that branch -- the regression I
observed. v3 drops the `!path` gate and moves `path` below it, which
is why it's fixed.
> > As topic2 is checked out in the worktree where the rebase is running
> > why did this line appear before?
This might be the same symptom from another cause: on master, head_ref
comes from refs_resolve_ref_unsafe(), and as you note its buffer is
overwritten inside branch_checked_out(). So by the time topic2 is
compared, wt-topic's lookup may already have clobbered head_ref,
letting topic2 fall through to the comment. I haven't run the test to
confirm, though.
Thanks,
Erik
next prev parent reply other threads:[~2026-07-25 11:21 UTC|newest]
Thread overview: 25+ 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 ` [PATCH 1/2] t3404: add failing branch symref test Son Luong Ngoc via GitGitGadget
2026-06-01 13:52 ` 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
2026-07-22 8:16 ` Son Luong Ngoc
2026-07-22 8:15 ` [PATCH v3 0/2] rebase: handle --update-refs branch symrefs Son Luong Ngoc via GitGitGadget
2026-07-22 8:15 ` [PATCH v3 1/2] rebase: skip branch symref aliases Son Luong Ngoc via GitGitGadget
2026-07-23 18:58 ` Phillip Wood
2026-07-24 9:55 ` Phillip Wood
2026-07-25 11:21 ` Erik Cervin-Edin [this message]
2026-07-26 15:42 ` Junio C Hamano
2026-07-28 9:36 ` Phillip Wood
2026-07-28 14:23 ` Junio C Hamano
2026-07-29 9:31 ` Phillip Wood
2026-07-29 14:26 ` Junio C Hamano
2026-07-30 13:10 ` Phillip Wood
2026-08-06 20:12 ` Junio C Hamano
2026-08-07 15:28 ` Phillip Wood
2026-07-22 8:15 ` [PATCH v3 2/2] rebase: guard non-branch symref targets Son Luong Ngoc via GitGitGadget
2026-08-07 15:22 ` 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=amSSYagL0jTgzElD@mbp \
--to=erik@cervined.in \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=sluongng@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.