OSDN Git Service

diff.c: factor out diff_flush_patch_all_file_pairs
[git-core/git.git] / pack-write.c
index fa97b72..a333ec6 100644 (file)
@@ -13,7 +13,7 @@ static int sha1_compare(const void *_a, const void *_b)
 {
        struct pack_idx_entry *a = *(struct pack_idx_entry **)_a;
        struct pack_idx_entry *b = *(struct pack_idx_entry **)_b;
-       return hashcmp(a->sha1, b->sha1);
+       return oidcmp(&a->oid, &b->oid);
 }
 
 static int cmp_uint32(const void *a_, const void *b_)
@@ -103,7 +103,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
                struct pack_idx_entry **next = list;
                while (next < last) {
                        struct pack_idx_entry *obj = *next;
-                       if (obj->sha1[0] != i)
+                       if (obj->oid.hash[0] != i)
                                break;
                        next++;
                }
@@ -122,11 +122,11 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
                        uint32_t offset = htonl(obj->offset);
                        sha1write(f, &offset, 4);
                }
-               sha1write(f, obj->sha1, 20);
+               sha1write(f, obj->oid.hash, 20);
                if ((opts->flags & WRITE_IDX_STRICT) &&
-                   (i && !hashcmp(list[-2]->sha1, obj->sha1)))
+                   (i && !oidcmp(&list[-2]->oid, &obj->oid)))
                        die("The same object %s appears twice in the pack",
-                           sha1_to_hex(obj->sha1));
+                           oid_to_hex(&obj->oid));
        }
 
        if (index_version >= 2) {