]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-branch.c
Makefile: Remove git-fsck and git-verify-pack from PROGRAMS
[thirdparty/git.git] / builtin-branch.c
index 7408285050a0f41a33d31c73e79c2fdefe567593..8956d0f84213afbd0e53e39bc863c05960f524f0 100644 (file)
@@ -623,9 +623,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
            (rename && force_create))
                usage(builtin_branch_usage);
 
-       head = xstrdup(resolve_ref("HEAD", head_sha1, 0, NULL));
+       head = resolve_ref("HEAD", head_sha1, 0, NULL);
        if (!head)
                die("Failed to resolve HEAD as a valid ref.");
+       head = xstrdup(head);
        if (!strcmp(head, "HEAD")) {
                detached = 1;
        }