Merge branch 'js/regexec-buf' into maint
[gitweb.git] / branch.c
index 1f1fbf528c638fc3a0dc9ae1b0f711870cd39af6..a5a8dcbd0ed929d09a73674361ee1dd81dd5b88c 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -334,12 +334,12 @@ void remove_branch_state(void)
        unlink(git_path_squash_msg());
 }
 
-void die_if_checked_out(const char *branch)
+void die_if_checked_out(const char *branch, int ignore_current_worktree)
 {
        const struct worktree *wt;
 
        wt = find_shared_symref("HEAD", branch);
-       if (!wt)
+       if (!wt || (ignore_current_worktree && wt->is_current))
                return;
        skip_prefix(branch, "refs/heads/", &branch);
        die(_("'%s' is already checked out at '%s'"),