mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
Merge branch 'rj/branch-unborn-in-other-worktrees'
Error messages given when working on an unborn branch that is checked out in another worktree have been improved. * rj/branch-unborn-in-other-worktrees: branch: avoid unnecessary worktrees traversals branch: rename orphan branches in any worktree branch: description for orphan branch errors branch: use get_worktrees() in copy_or_rename_branch() branch: test for failures while renaming branches
This commit is contained in:
27
branch.c
27
branch.c
@@ -840,30 +840,3 @@ void die_if_checked_out(const char *branch, int ignore_current_worktree)
|
||||
|
||||
free_worktrees(worktrees);
|
||||
}
|
||||
|
||||
int replace_each_worktree_head_symref(const char *oldref, const char *newref,
|
||||
const char *logmsg)
|
||||
{
|
||||
int ret = 0;
|
||||
struct worktree **worktrees = get_worktrees();
|
||||
int i;
|
||||
|
||||
for (i = 0; worktrees[i]; i++) {
|
||||
struct ref_store *refs;
|
||||
|
||||
if (worktrees[i]->is_detached)
|
||||
continue;
|
||||
if (!worktrees[i]->head_ref)
|
||||
continue;
|
||||
if (strcmp(oldref, worktrees[i]->head_ref))
|
||||
continue;
|
||||
|
||||
refs = get_worktree_ref_store(worktrees[i]);
|
||||
if (refs_create_symref(refs, "HEAD", newref, logmsg))
|
||||
ret = error(_("HEAD of working tree %s is not updated"),
|
||||
worktrees[i]->path);
|
||||
}
|
||||
|
||||
free_worktrees(worktrees);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user