mbox series

[v4,0/3] branch: operations on orphan branches

Message ID 139555f1-21ab-d987-a58e-c7f04ce222d3@gmail.com (mailing list archive)
Headers show
Series branch: operations on orphan branches | expand

Message

Rubén Justo Feb. 22, 2023, 10:50 p.m. UTC
Avoid some confusing errors operating with orphan branches when working
with worktrees.

Changes from v3:

This is a major refactoring based on the comments from the reviews of
v3.  The intention is to make no functional changes in this iteration,
except a change to maintain unchanged the user-visible behavior, as
Jonathan suggested.

Summary of changes:

  - Inlined reject_rebase_or_bisect_branch() and
    replace_each_head_symref() into copy_or_rename_branch(). 

  - Used names to define HEAD states.

  - Moved die("Branch foo is being rebased/bisected...") after the call
    to validate_branchname(), to maintain the user-visible behavior.

  - Removed the use of ternary operators to avoid introducing unneeded
    noise in the patch.
 

Rubén Justo (3):
  branch: avoid unnecessary worktrees traversals
  branch: description for orphan branch errors
  branch: rename orphan branches in any worktree

 branch.c               | 27 ------------
 branch.h               |  8 ----
 builtin/branch.c       | 99 ++++++++++++++++++++++++++++--------------
 t/t3200-branch.sh      | 14 ++++++
 t/t3202-show-branch.sh | 18 ++++++++
 5 files changed, 98 insertions(+), 68 deletions(-)