diff options
| author | Patryk Obara <patryk.obara@gmail.com> | 2018-01-28 01:13:19 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-01-30 10:42:36 -0800 |
| commit | a09c985eae694db1cf31c72db0e2e1bf42f1274f (patch) | |
| tree | 3acdfc26ab59d2ac822e4b4cf6ad93bf746fb65d /builtin/unpack-objects.c | |
| parent | notes: convert write_notes_tree to object_id (diff) | |
| download | git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.tar.gz git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.zip | |
sha1_file: convert write_sha1_file to object_id
Convert the definition and declaration of write_sha1_file to
struct object_id and adjust usage of this function.
This commit also converts static function write_sha1_file_prepare, as it
is closely related.
Rename these functions to write_object_file and
write_object_file_prepare respectively.
Replace sha1_to_hex, hashcpy and hashclr with their oid equivalents
wherever possible.
Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/unpack-objects.c')
| -rw-r--r-- | builtin/unpack-objects.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 85a40d1af7..397371eb3d 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -172,7 +172,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf) { struct object_id oid; - if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0) + if (write_object_file(obj_buf->buffer, obj_buf->size, + typename(obj->type), &oid) < 0) die("failed to write object %s", oid_to_hex(&obj->oid)); obj->flags |= FLAG_WRITTEN; } @@ -237,14 +238,16 @@ static void write_object(unsigned nr, enum object_type type, void *buf, unsigned long size) { if (!strict) { - if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0) + if (write_object_file(buf, size, typename(type), + &obj_list[nr].oid) < 0) die("failed to write object"); added_object(nr, type, buf, size); free(buf); obj_list[nr].obj = NULL; } else if (type == OBJ_BLOB) { struct blob *blob; - if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0) + if (write_object_file(buf, size, typename(type), + &obj_list[nr].oid) < 0) die("failed to write object"); added_object(nr, type, buf, size); free(buf); |
