]> git.proxmox.com Git - libgit2.git/commitdiff
worktree: use fully qualified reference name for created HEAD
authorPatrick Steinhardt <ps@pks.im>
Wed, 15 Mar 2017 15:35:43 +0000 (16:35 +0100)
committerPatrick Steinhardt <ps@pks.im>
Fri, 17 Mar 2017 08:27:55 +0000 (09:27 +0100)
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.

src/worktree.c

index 13113f8469a342ec69892fdd0637d28eee9cc79e..f90d8222a35940f103ff3aaf1ae6f070c2a0beba 100644 (file)
@@ -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;