When I suggested adding a helper I was thinking of something like
static const struct worktree *do_find_shared_symref(struct worktree
**worktrees,
const char *symref,
const char *target,
int ignore_current)
{
/*
* Body moved from find_share_symref() with a couple
* of lines added to support ignore_current
/*
}const struct worktree *find_shared_symref(struct worktree **worktrees,
const char *symref,
const char *target)
{
return do_find_shared_symref(worktrees, symref, target, 0)
}void die_if_checked_out(const char *branch, int ignore_current_worktree)
{
struct worktree **worktrees = get_worktrees();
const struct worktree *wt; wt = do_find_shared_symref(worktrees, "HEAD", branch,
ignore_current_worktree);
/* rest unchanged */
}
The aim was to avoid changing the public api
Best Wishes
Phillip