Re: [PATCH v20 0/7] branch: delete-merged

Harald Nordgren <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CAHwyqnUmq1fMC9qEbX+7P7W=TL1d7HaXMDsj2QoLZ+nQqRKOAw@mail.gmail.com>
On Wed, Jul 22, 2026 at 3:39 PM Phillip Wood <[email protected]> wrote:
>
> Hi Harald
>
> On 22/07/2026 08:10, Harald Nordgren via GitGitGadget wrote:
> > Delete branches that have already been merged on upstream.
> >
> > Changes in v20:
> >
> >   * Protect branches transitively required by a surviving local upstream
> >     stack. Traverse upstream chains once and defer delete-set mutation until
> >     traversal completes.
> >   * Make stacked-branch handling independent of ref iteration order and
> >     update the documentation accordingly.
> >   * Clarify variable names with regards to branch names (short) to reduce
> >     confusion.
>
> I'm having a hard time reading the range diff due to the renaming of the
> members of "struct stacked_branch_data". Can you explain what has
> changed in the logic to protect branches that are upstreams of unmerged
> branches and why please? In particular why wasn't sufficient to stop
> removing the members of "spared" from "deletable" in
> spare_stacked_base() and remove them after refs_for_each_branch_ref()
> has returned instead.

Hmm. The main idea is to bite the bullet and actually traverse the
graph since it didn't seem possible to finish the job correctly in a
single pass anotherwise which I'm trying to demonstrate with

    test_expect_success '--delete-merged keeps the upstream chain of a
surviving branch' '

It becomes a bit like whack-a-mole when Junio asks me to clarify the
code and now you cannot review it because of that. I'm still not
friends with range-diff even after using it for some time, I agree
that the diff v19...v20 doesn't look very inviting.


Harald
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.