Merge branch 'jc/check-ref-format-oor'
[gitweb.git] / worktree.c
index 70015629dc69e4bdf7f8ef1973596f3360898da3..f5da7d286d537fa99a1bd2dd5180068b9d85da2f 100644 (file)
@@ -31,7 +31,7 @@ static void add_head_info(struct worktree *wt)
        target = refs_resolve_ref_unsafe(get_worktree_ref_store(wt),
                                         "HEAD",
                                         0,
-                                        wt->head_sha1, &flags);
+                                        &wt->head_oid, &flags);
        if (!target)
                return;
 
@@ -327,7 +327,8 @@ const struct worktree *find_shared_symref(const char *symref,
                refs = get_worktree_ref_store(wt);
                symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
                                                        NULL, &flags);
-               if ((flags & REF_ISSYMREF) && !strcmp(symref_target, target)) {
+               if ((flags & REF_ISSYMREF) &&
+                   symref_target && !strcmp(symref_target, target)) {
                        existing = wt;
                        break;
                }