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

@ -357,7 +357,8 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref)
if (strcmp(oldref, worktrees[i]->head_ref))
continue;
if (set_worktree_head_symref(worktrees[i]->git_dir, newref)) {
if (set_worktree_head_symref(get_worktree_git_dir(worktrees[i]),
newref)) {
ret = -1;
error(_("HEAD of working tree %s is not updated"),
worktrees[i]->path);