mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
65f9b75dfe
commit
41af65651d
8
branch.h
8
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
|
||||
|
||||
Reference in New Issue
Block a user