Skip to content
  • Rubén Justo's avatar
    branch: test for failures while renaming branches · 2e8af499
    Rubén Justo authored and Junio C Hamano's avatar Junio C Hamano committed
    When we introduced replace_each_worktree_head_symref() in 70999e9c
    
    
    (branch -m: update all per-worktree HEADs, 2016-03-27), we implemented a
    best effort approach.
    
    If we are asked to rename a branch that is simultaneously checked out in
    multiple worktrees, we try to update all of those worktrees.  If we fail
    updating any of them, we die() as a signal that something has gone
    wrong.  However, at this point, the branch ref has already been renamed
    and also updated the HEADs of the successfully updated worktrees.
    Despite returning an error, we do not try to rollback those changes.
    
    Let's add a test to notice if we change this behavior in the future.
    
    In next commits we will change replace_each_worktree_head_symref() to
    work more closely with its only caller, copy_or_rename_branch().  Let's
    move the former closer to its caller, to facilitate those changes.
    
    Signed-off-by: default avatarRubén Justo <rjusto@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    2e8af499