On 7/1/23 0:59, Junio C Hamano wrote: > Rubén Justo <rjusto@xxxxxxxxx> writes: > >> Thinking of this as a whole, perhaps after this series we can add: > > Why "after"? If we already know that the existing patches are > making things worse and need to fix the regression with a future > patch to make it usable again, why introduce a regression in the > first place? > I'm not sure if it is so worse, and if the optimization is a fix. We're actually paying for worktrees twice in: reject_rebase_or_bisedt_branch() and replace_each_worktree_head_symref(). Making the change this way makes more obvious IMHO what we are moving and why. Start moving the ref_exists() in 1/2, easily leads to 2/1 and this patch squashed with 1/2, for little gain (IMHO) and worse history. This is why I think it's a good sequence. But I understand your point and I'm not opposed to doing it as you suggest if you think the current way doesn't pay off.