Add a place for (not) sharing stuff between worktrees
[gitweb.git] / refs / packed-backend.c
index cec3fb9e00f78c1e0be9f24bd07aa756d56afc00..74e2996e93ad0033bd4650f8dd7d894a46d563b3 100644 (file)
@@ -499,6 +499,7 @@ static int load_contents(struct snapshot *snapshot)
        size = xsize_t(st.st_size);
 
        if (!size) {
+               close(fd);
                return 0;
        } else if (mmap_strategy == MMAP_NONE || size <= SMALL_FILE_SIZE) {
                snapshot->buf = xmalloc(size);
@@ -1159,7 +1160,7 @@ static int write_with_updates(struct packed_ref_store *refs,
                                                    "reference already exists",
                                                    update->refname);
                                        goto error;
-                               } else if (oidcmp(&update->old_oid, iter->oid)) {
+                               } else if (!oideq(&update->old_oid, iter->oid)) {
                                        strbuf_addf(err, "cannot update ref '%s': "
                                                    "is at %s but expected %s",
                                                    update->refname,