From 69dfe3b9420eb2a7f479a0a4cad663111af2b1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 22 Apr 2016 20:01:26 +0700 Subject: worktree.c: store "id" instead of "git_dir" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can reconstruct git_dir from id quite easily. It's a bit hackier to do the reverse. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- worktree.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'worktree.h') diff --git a/worktree.h b/worktree.h index b4b3dda79..3198c8da2 100644 --- a/worktree.h +++ b/worktree.h @@ -3,7 +3,7 @@ struct worktree { char *path; - char *git_dir; + char *id; char *head_ref; unsigned char head_sha1[20]; int is_detached; @@ -22,6 +22,12 @@ struct worktree { */ extern struct worktree **get_worktrees(void); +/* + * Return git dir of the worktree. Note that the path may be relative. + * If wt is NULL, git dir of current worktree is returned. + */ +extern const char *get_worktree_git_dir(const struct worktree *wt); + /* * Free up the memory for worktree(s) */ -- cgit v1.2.1