path: root/branch.h
diff options
authorEric Sunshine <>2015-07-17 23:00:04 (GMT)
committerJunio C Hamano <>2015-07-20 18:29:24 (GMT)
commited89f84b3c05d6359aba842e245910c996d91859 (patch)
tree3972049b8bae8865590f68c2a74d9df244e21193 /branch.h
parent746bbdc64f1e1b2618cd71e5da81e38aa772e8ba (diff)
branch: publish die_if_checked_out()
git-worktree currently conflates new branch creation, setting of HEAD in the new wortkree, and worktree population into a single sub-invocation of git-checkout. However, these operations will eventually be separated, and git-worktree itself will need to be able to detect if the branch is already checked out elsewhere, rather than relying upon git-branch to make this determination, so publish die_if_checked_out(). Signed-off-by: Eric Sunshine <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'branch.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/branch.h b/branch.h
index 64173ab..58aa45f 100644
--- a/branch.h
+++ b/branch.h
@@ -52,4 +52,11 @@ extern void install_branch_config(int flag, const char *local, const char *origi
extern int read_branch_desc(struct strbuf *, const char *branch_name);
+ * Check if a branch is checked out in the main worktree or any linked
+ * worktree and die (with a message describing its checkout location) if
+ * it is.
+ */
+extern void die_if_checked_out(const char *branch);