summaryrefslogtreecommitdiff
path: root/branch.h
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2015-08-10 17:52:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-11 20:48:15 (GMT)
commit41af65651d4333cd19ab4af3509fa2d08f3816ed (patch)
tree19a55a6e2d48d20fc6bee7f6f2a99f3ae7ba8f0d /branch.h
parent65f9b75dfe34a67cf4c6a8507f999c5710d36ba9 (diff)
downloadgit-41af65651d4333cd19ab4af3509fa2d08f3816ed.zip
git-41af65651d4333cd19ab4af3509fa2d08f3816ed.tar.gz
git-41af65651d4333cd19ab4af3509fa2d08f3816ed.tar.bz2
worktrees: add find_shared_symref
Add a new function, find_shared_symref, which contains the heart of die_if_checked_out, but works for any symref, not just HEAD. Refactor die_if_checked_out to use the same infrastructure as find_shared_symref. Soon, we will use find_shared_symref to protect notes merges in worktrees. Signed-off-by: David Turner <dturner@twopensource.com> Reviewed-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.h')
-rw-r--r--branch.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/branch.h b/branch.h
index 58aa45f..d3446ed 100644
--- a/branch.h
+++ b/branch.h
@@ -59,4 +59,12 @@ extern int read_branch_desc(struct strbuf *, const char *branch_name);
*/
extern void die_if_checked_out(const char *branch);
+/*
+ * Check if a per-worktree symref points to a ref in the main worktree
+ * or any linked worktree, and return the path to the exising worktree
+ * if it is. Returns NULL if there is no existing ref. The caller is
+ * responsible for freeing the returned path.
+ */
+extern char *find_shared_symref(const char *symref, const char *target);
+
#endif