From: Harald Nordgren Date: Wed, 22 Jul 2026 15:41:06 GMT Subject: Re: [PATCH v20 0/7] branch: delete-merged Message-ID: In-Reply-To: <20976edc-fc9d-4d4d-8919-b599d336f9cc@gmail.com> On Wed, Jul 22, 2026 at 3:39 PM Phillip Wood 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