From: Eric Sunshine Date: Thu, 21 Apr 2016 07:02:53 GMT Subject: Re: [PATCH v2 03/12] worktree.c: make find_shared_symref() return struct worktree * Message-ID: In-Reply-To: <1461158693-21289-4-git-send-email-pclouds@gmail.com> On Wed, Apr 20, 2016 at 9:24 AM, Nguyễn Thái Ngọc Duy wrote: > 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 > --- > 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/ > - * 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);