Re: [PATCH v14 4/6] branch: add --prune-merged <branch>
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jun 22, 2026, 09:57 UTC
- Message-ID
- <ddf37b2d-29b4-4a3c-b7d9-b681af028b24@gmail.com>
- In-Reply-To
- <CAHwyqnVQwK1w9ap1-e=ii4a-BVOZ=oQtCdkTxB=TJF30kNaZoQ@mail.gmail.com>
On 22/06/2026 10:37, Harald Nordgren wrote:
> Hi! I implemented this in v17.
That seems to preserve all the upstreams, rather than preserving the upstreams of unmerged branches and clearing the upstream setting of merged branches. It also builds a list of upstream branches rather than just pruning the set of to-be-deleted branches in the refs_for_each_branch_ref() callback which seems a bit wasteful.
Thanks
Phillip
Show 34 quoted lines
> > Harald > > On Mon, Jun 22, 2026 at 11:28 AM Phillip Wood <phillip.wood123@gmail.com> wrote: >> >> On 22/06/2026 10:09, Phillip Wood wrote: >>> Hi Harald >>> >>> On 21/06/2026 19:46, Harald Nordgren wrote: >>>> Looking into this more and attempting to implement the logic for >>>> re-assigning the upstream, it becomes quite a lot of code. >> >> Having re-read you previous message I'm coming round to the idea of >> clearing the upstream of branches that have been merged but cannot be >> deleted because they are the upstream of an unmerged branch. Is that >> easier than reassigning the upstream? >> >> Thanks >> >> Phillip >> >>>> Maybe an easier way forward now is to avoid deleting these cases. We >>>> can always add the re-assigning logic later on without breaking >>>> backward compatibility. >>> >>> Not deleting the branch is certainly safest and should be fairly easy to >>> implement. Adding an option to reassign the upstream later sounds fine >>> to me. >>> >>> Thanks >>> >>> Phillip >>> >>