builtin/am: convert uses of EMPTY_TREE_SHA1_BIN to the_hash_algo
[gitweb.git] / sha1_file.c
index 1617e2549592503b93cebd51d776e6c1f890336b..11598b43eba73f7649ec8c9b3b4c5e0f2e98e270 100644 (file)
@@ -100,6 +100,18 @@ const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = {
        },
 };
 
+const char *empty_tree_oid_hex(void)
+{
+       static char buf[GIT_MAX_HEXSZ + 1];
+       return oid_to_hex_r(buf, the_hash_algo->empty_tree);
+}
+
+const char *empty_blob_oid_hex(void)
+{
+       static char buf[GIT_MAX_HEXSZ + 1];
+       return oid_to_hex_r(buf, the_hash_algo->empty_blob);
+}
+
 /*
  * This is meant to hold a *small* number of objects that you would
  * want read_sha1_file() to be able to return, but yet you do not want
@@ -1268,7 +1280,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
        }
 
        while (1) {
-               if (find_pack_entry(the_repository, real->hash, &e))
+               if (find_pack_entry(the_repository, real, &e))
                        break;
 
                if (flags & OBJECT_INFO_IGNORE_LOOSE)
@@ -1281,7 +1293,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
                /* Not a loose object; someone else may have just packed it. */
                if (!(flags & OBJECT_INFO_QUICK)) {
                        reprepare_packed_git(the_repository);
-                       if (find_pack_entry(the_repository, real->hash, &e))
+                       if (find_pack_entry(the_repository, real, &e))
                                break;
                }
 
@@ -1669,7 +1681,7 @@ static int freshen_loose_object(const struct object_id *oid)
 static int freshen_packed_object(const struct object_id *oid)
 {
        struct pack_entry e;
-       if (!find_pack_entry(the_repository, oid->hash, &e))
+       if (!find_pack_entry(the_repository, oid, &e))
                return 0;
        if (e.p->freshened)
                return 1;