config: move flockfile() closer to unlocked functions
[gitweb.git] / worktree.c
index 8aaeea03771cfefa9edd019d0dc5146fef17a9c7..f8c40f2f5f8ce5b18c976b5281f5618adbeee4a7 100644 (file)
@@ -307,7 +307,6 @@ const struct worktree *find_shared_symref(const char *symref,
        for (i = 0; worktrees[i]; i++) {
                struct worktree *wt = worktrees[i];
                const char *symref_target;
-               unsigned char sha1[20];
                struct ref_store *refs;
                int flags;
 
@@ -327,8 +326,9 @@ const struct worktree *find_shared_symref(const char *symref,
 
                refs = get_worktree_ref_store(wt);
                symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
-                                                       sha1, &flags);
-               if ((flags & REF_ISSYMREF) && !strcmp(symref_target, target)) {
+                                                       NULL, &flags);
+               if ((flags & REF_ISSYMREF) &&
+                   symref_target && !strcmp(symref_target, target)) {
                        existing = wt;
                        break;
                }