summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;