Re: [PATCH v2 03/12] worktree.c: make find_shared_symref() return struct worktree *
On Wed, Apr 20, 2016 at 9:24 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 11 quoted lines
> This gives the caller more information and they can answer things like,
> "is it the main worktree" or "is it the current worktree". The latter
> question is needed for the "checkout a rebase branch" case later.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/worktree.h b/worktree.h
> @@ -36,9 +36,10 @@ extern void free_worktrees(struct worktree **);
> /*
> * 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
Doesn't "return the path" become outdated with this patch?
Also (not a new problem): s/exising/existing/
Show 8 quoted lines
> - * if it is. Returns NULL if there is no existing ref. The caller is
> - * responsible for freeing the returned path.
> + * if it is. Returns NULL if there is no existing ref. The result
> + * may be destroyed by the next call.
> */
> -extern char *find_shared_symref(const char *symref, const char *target);
> +extern const struct worktree *find_shared_symref(const char *symref,
> + const char *target);