worktree.c: store "id" instead of "git_dir"

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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2016-04-22 20:01:26 +07:00
committed by Junio C Hamano
parent 15cdfea734
commit 69dfe3b942
3 changed files with 27 additions and 15 deletions

View File

@ -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)
*/