commit e8f369580ec5089cc0699635df9c4ff1bccc26db from: Stefan Sperling date: Sun Mar 11 12:11:43 2018 UTC read / free the head ref when work tree is opened / closed commit - d6c38e0dea408f682753c7d187bf15e48fd51df6 commit + e8f369580ec5089cc0699635df9c4ff1bccc26db blob - cef7d3dd4332ca2ce211998bce72293d400903dc blob + f691b7afd2ce973e707f0cfdb50e825617b8c488 --- lib/got_worktree_priv.h +++ lib/got_worktree_priv.h @@ -19,6 +19,7 @@ struct got_worktree { char *path_repo; char *path_prefix; char *base_commit; + char *head_ref; /* * File descriptor for the lock file, open while a work tree is open. blob - 4355b63996fbfccfb5e07e406648dfb6f55e3d56 blob + 129390074ae0a5605d0629876e1b4b24c9ff125a --- lib/worktree.c +++ lib/worktree.c @@ -293,6 +293,11 @@ got_worktree_open(struct got_worktree **worktree, cons err = read_meta_file(&(*worktree)->base_commit, path_got, GOT_WORKTREE_BASE_COMMIT); + if (err) + goto done; + + err = read_meta_file(&(*worktree)->head_ref, path_got, + GOT_WORKTREE_HEAD); if (err) goto done; @@ -318,6 +323,7 @@ got_worktree_close(struct got_worktree *worktree) free(worktree->path_repo); free(worktree->path_prefix); free(worktree->base_commit); + free(worktree->head_ref); if (worktree->lockfd != -1) close(worktree->lockfd); free(worktree);