sha1_file: convert force_object_loose to object_id
[gitweb.git] / sha1_file.c
index d1569b1b961c11c170b17e9011f9bb8db334a031..d9ee966d7423f2774dbcf66b92450801a28ec71b 100644 (file)
@@ -1670,7 +1670,7 @@ int hash_sha1_file_literally(const void *buf, unsigned long len, const char *typ
        return status;
 }
 
-int force_object_loose(const unsigned char *sha1, time_t mtime)
+int force_object_loose(const struct object_id *oid, time_t mtime)
 {
        void *buf;
        unsigned long len;
@@ -1679,13 +1679,13 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
        int hdrlen;
        int ret;
 
-       if (has_loose_object(sha1))
+       if (has_loose_object(oid->hash))
                return 0;
-       buf = read_object(sha1, &type, &len);
+       buf = read_object(oid->hash, &type, &len);
        if (!buf)
-               return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
+               return error("cannot read sha1_file for %s", oid_to_hex(oid));
        hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
-       ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
+       ret = write_loose_object(oid->hash, hdr, hdrlen, buf, len, mtime);
        free(buf);
 
        return ret;