From 662078caacd450f93faa72e0e7d8580c42621415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Justo?= Date: Sat, 25 Feb 2023 15:21:51 +0100 Subject: worktree: introduce is_shared_symref() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new function, is_shared_symref(), which contains the heart of find_shared_symref(). Refactor find_shared_symref() to use the new function is_shared_symref(). Soon, we will use is_shared_symref() to search for symref beyond the first worktree that matches. Signed-off-by: Rubén Justo Signed-off-by: Junio C Hamano --- worktree.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'worktree.h') diff --git a/worktree.h b/worktree.h index 9dcea6fc8c..7889c4761d 100644 --- a/worktree.h +++ b/worktree.h @@ -149,6 +149,12 @@ const struct worktree *find_shared_symref(struct worktree **worktrees, const char *symref, const char *target); +/* + * Returns true if a symref points to a ref in a worktree. + */ +int is_shared_symref(const struct worktree *wt, + const char *symref, const char *target); + /* * Similar to head_ref() for all HEADs _except_ one from the current * worktree, which is covered by head_ref(). -- cgit v1.2.3