summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-03-15 16:35:43 +0100
committerPatrick Steinhardt <ps@pks.im>2017-03-17 09:27:55 +0100
commit9dcc79bc6a6ef9d0704e598c38e2e98cd4f41f30 (patch)
treede0358adcb1dff2638b2821a946394ba40358757
parent20a368e2d72e65b6401f18a440c24df0dd9683ae (diff)
downloadlibgit2-9dcc79bc6a6ef9d0704e598c38e2e98cd4f41f30.tar.gz
worktree: use fully qualified reference name for created HEAD
When creating a new worktree, we have to set up the initial data structures. Next to others, this also includes the HEAD pseudo-ref. We currently set it to the worktree respectively branch name, which is actually not fully qualified. Use the fully qualified branch name instead.
-rw-r--r--src/worktree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/worktree.c b/src/worktree.c
index 13113f846..f90d8222a 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -323,7 +323,7 @@ int git_worktree_add(git_worktree **out, git_repository *repo, const char *name,
goto out;
/* Set worktree's HEAD */
- if ((err = git_repository_create_head(path.ptr, name)) < 0)
+ if ((err = git_repository_create_head(path.ptr, git_reference_name(ref))) < 0)
goto out;
if ((err = git_repository_open(&wt, worktree)) < 0)
goto out;