fetch-pack: clear alternate shallow when complete
[gitweb.git] / notes.c
diff --git a/notes.c b/notes.c
index a386d450c4c812ef30d0fc661fe2c03e1d062a83..7f7cc4d5112cd8f5098477d03034e8c8886dcb84 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "notes.h"
+#include "object-store.h"
 #include "blob.h"
 #include "tree.h"
 #include "utf8.h"
@@ -146,7 +147,7 @@ static struct leaf_node *note_tree_find(struct notes_tree *t,
        void **p = note_tree_search(t, &tree, &n, key_sha1);
        if (GET_PTR_TYPE(*p) == PTR_TYPE_NOTE) {
                struct leaf_node *l = (struct leaf_node *) CLR_PTR_TYPE(*p);
-               if (!hashcmp(key_sha1, l->key_oid.hash))
+               if (hasheq(key_sha1, l->key_oid.hash))
                        return l;
        }
        return NULL;
@@ -205,7 +206,7 @@ static void note_tree_remove(struct notes_tree *t,
        if (GET_PTR_TYPE(*p) != PTR_TYPE_NOTE)
                return; /* type mismatch, nothing to remove */
        l = (struct leaf_node *) CLR_PTR_TYPE(*p);
-       if (oidcmp(&l->key_oid, &entry->key_oid))
+       if (!oideq(&l->key_oid, &entry->key_oid))
                return; /* key mismatch, nothing to remove */
 
        /* we have found a matching entry */
@@ -265,9 +266,9 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
        case PTR_TYPE_NOTE:
                switch (type) {
                case PTR_TYPE_NOTE:
-                       if (!oidcmp(&l->key_oid, &entry->key_oid)) {
+                       if (oideq(&l->key_oid, &entry->key_oid)) {
                                /* skip concatenation if l == entry */
-                               if (!oidcmp(&l->val_oid, &entry->val_oid))
+                               if (oideq(&l->val_oid, &entry->val_oid))
                                        return 0;
 
                                ret = combine_notes(&l->val_oid,
@@ -449,7 +450,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
 
                l = xcalloc(1, sizeof(*l));
                oidcpy(&l->key_oid, &object_oid);
-               oidcpy(&l->val_oid, entry.oid);
+               oidcpy(&l->val_oid, &entry.oid);
                if (note_tree_insert(t, node, n, l, type,
                                     combine_notes_concatenate))
                        die("Failed to load %s %s into notes tree "
@@ -480,7 +481,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
                        }
                        strbuf_addstr(&non_note_path, entry.path);
                        add_non_note(t, strbuf_detach(&non_note_path, NULL),
-                                    entry.mode, entry.oid->hash);
+                                    entry.mode, entry.oid.hash);
                }
        }
        free(buf);