notes: convert internal parts to struct object_id
[gitweb.git] / branch.c
index 1758c9708604608f9a40097a18b5468a8f1a8451..985316eb76505a60bca0aa303322bef35e7defaa 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -286,7 +286,7 @@ void create_branch(const char *name, const char *start_name,
                break;
        }
 
-       if ((commit = lookup_commit_reference(oid.hash)) == NULL)
+       if ((commit = lookup_commit_reference(&oid)) == NULL)
                die(_("Not a valid branch point: '%s'."), start_name);
        oidcpy(&oid, &commit->object.oid);
 
@@ -353,17 +353,18 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref,
        int i;
 
        for (i = 0; worktrees[i]; i++) {
+               struct ref_store *refs;
+
                if (worktrees[i]->is_detached)
                        continue;
-               if (strcmp(oldref, worktrees[i]->head_ref))
+               if (worktrees[i]->head_ref &&
+                   strcmp(oldref, worktrees[i]->head_ref))
                        continue;
 
-               if (set_worktree_head_symref(get_worktree_git_dir(worktrees[i]),
-                                            newref, logmsg)) {
-                       ret = -1;
-                       error(_("HEAD of working tree %s is not updated"),
-                             worktrees[i]->path);
-               }
+               refs = get_worktree_ref_store(worktrees[i]);
+               if (refs_create_symref(refs, "HEAD", newref, logmsg))
+                       ret = error(_("HEAD of working tree %s is not updated"),
+                                   worktrees[i]->path);
        }
 
        free_worktrees(worktrees);