completion: support excluding refs
[gitweb.git] / worktree.c
index aab4b9552e429692943a2b49cd4c8b7379dab68b..6b4f5f3e6dc99379311622f7f7900f56cc706e78 100644 (file)
@@ -20,7 +20,7 @@ void free_worktrees(struct worktree **worktrees)
 
 /*
  * read 'path_to_ref' into 'ref'.  Also if is_detached is not NULL,
- * set is_detached to 1 (0) if the ref is detatched (is not detached).
+ * set is_detached to 1 (0) if the ref is detached (is not detached).
  *
  * $GIT_COMMON_DIR/$symref (e.g. HEAD) is practically outside $GIT_DIR so
  * for linked worktrees, `resolve_ref_unsafe()` won't work (it uses
@@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)
        int is_bare = 0;
        int is_detached = 0;
 
-       strbuf_addstr(&worktree_path, absolute_path(get_git_common_dir()));
+       strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
        is_bare = !strbuf_strip_suffix(&worktree_path, "/.git");
        if (is_bare)
                strbuf_strip_suffix(&worktree_path, "/.");
@@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)
        strbuf_rtrim(&worktree_path);
        if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
                strbuf_reset(&worktree_path);
-               strbuf_addstr(&worktree_path, absolute_path("."));
+               strbuf_add_absolute_path(&worktree_path, ".");
                strbuf_strip_suffix(&worktree_path, "/.");
        }
 
@@ -216,8 +216,8 @@ const char *get_worktree_git_dir(const struct worktree *wt)
                return git_common_path("worktrees/%s", wt->id);
 }
 
-static int is_worktree_being_rebased(const struct worktree *wt,
-                                    const char *target)
+int is_worktree_being_rebased(const struct worktree *wt,
+                             const char *target)
 {
        struct wt_status_state state;
        int found_rebase;
@@ -234,8 +234,8 @@ static int is_worktree_being_rebased(const struct worktree *wt,
        return found_rebase;
 }
 
-static int is_worktree_being_bisected(const struct worktree *wt,
-                                     const char *target)
+int is_worktree_being_bisected(const struct worktree *wt,
+                              const char *target)
 {
        struct wt_status_state state;
        int found_rebase;