return 0;
}
-int hash_object_file(const struct git_hash_algo *algo, const void *buf,
+void hash_object_file(const struct git_hash_algo *algo, const void *buf,
unsigned long len, const char *type,
struct object_id *oid)
{
char hdr[MAX_HEADER_LEN];
int hdrlen = sizeof(hdr);
write_object_file_prepare(algo, buf, len, type, oid, hdr, &hdrlen);
- return 0;
}
/* Finalize a file on disk, and close it. */
enum object_type type,
const char *path, unsigned flags)
{
- int ret;
+ int ret = 0;
int re_allocated = 0;
int write_object = flags & HASH_WRITE_OBJECT;
if (write_object)
ret = write_object_file(buf, size, type_name(type), oid);
else
- ret = hash_object_file(the_hash_algo, buf, size,
- type_name(type), oid);
+ hash_object_file(the_hash_algo, buf, size, type_name(type),
+ oid);
+
if (re_allocated)
free(buf);
return ret;
const char *path,
unsigned flags)
{
- int ret;
+ int ret = 0;
const int write_object = flags & HASH_WRITE_OBJECT;
struct strbuf sbuf = STRBUF_INIT;
ret = write_object_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
oid);
else
- ret = hash_object_file(the_hash_algo, sbuf.buf, sbuf.len,
- type_name(OBJ_BLOB), oid);
+ hash_object_file(the_hash_algo, sbuf.buf, sbuf.len,
+ type_name(OBJ_BLOB), oid);
strbuf_release(&sbuf);
return ret;
}
/* Read and unpack an object file into memory, write memory to an object file */
int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
-int hash_object_file(const struct git_hash_algo *algo, const void *buf,
- unsigned long len, const char *type,
- struct object_id *oid);
+void hash_object_file(const struct git_hash_algo *algo, const void *buf,
+ unsigned long len, const char *type,
+ struct object_id *oid);
int write_object_file_flags(const void *buf, unsigned long len,
const char *type, struct object_id *oid,