Merge branch 'bc/rev-parse-parseopt-fix'
[gitweb.git] / branch.c
index ce1f8bb58ebd4709e2b13e85232d7138d5cde0d6..4377ce2fb17d7467ee92d4db02cb4859f6397505 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -191,9 +191,8 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
 
        if (!attr_only) {
                const char *head;
-               struct object_id oid;
 
-               head = resolve_ref_unsafe("HEAD", 0, oid.hash, NULL);
+               head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
                if (!is_bare_repository() && head && !strcmp(head, ref->buf))
                        die(_("Cannot force update the current branch."));
        }
@@ -357,8 +356,9 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref,
 
                if (worktrees[i]->is_detached)
                        continue;
-               if (worktrees[i]->head_ref &&
-                   strcmp(oldref, worktrees[i]->head_ref))
+               if (!worktrees[i]->head_ref)
+                       continue;
+               if (strcmp(oldref, worktrees[i]->head_ref))
                        continue;
 
                refs = get_worktree_ref_store(worktrees[i]);