On Sat, Sep 29, 2018 at 3:11 PM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote: > Make use of the new ref aliases to pass refs from another worktree > around and access them from the current ref store instead. This does > not change any functionality, but when a problem arises, we would like > the reported messages to mention full ref aliases, like this: > [...] > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > diff --git a/worktree.c b/worktree.c > @@ -487,6 +487,28 @@ int submodule_uses_worktrees(const char *path) > +void strbuf_worktree_ref(const struct worktree *wt, > + struct strbuf *sb, > + const char *refname) > +{ > + if (wt && !wt->is_current) { > + if (is_main_worktree(wt)) > + strbuf_addstr(sb, "main/"); I think this needs to be "main-worktree/", doesn't it? > + else > + strbuf_addf(sb, "worktrees/%s/", wt->id); > + } > + strbuf_addstr(sb, refname); > +} > diff --git a/worktree.h b/worktree.h > @@ -108,4 +108,18 @@ extern const char *worktree_git_path(const struct worktree *wt, > +/* > + * Return a refname suitable for access from the current ref > + * store. The result may be destroyed at the next call. s/may/will/