diff options
author | Patryk Obara <patryk.obara@gmail.com> | 2018-01-28 00:13:11 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-30 18:42:35 (GMT) |
commit | 829e5c3b9276a2369452a119faec234276b7ecbb (patch) | |
tree | 82fe18c36999ed42d4c2e3ca98ea443deaec69fd /sha1_file.c | |
parent | 5be1f00a9a701532232f57958efab4be8c959a29 (diff) | |
download | git-829e5c3b9276a2369452a119faec234276b7ecbb.zip git-829e5c3b9276a2369452a119faec234276b7ecbb.tar.gz git-829e5c3b9276a2369452a119faec234276b7ecbb.tar.bz2 |
sha1_file: convert pretend_sha1_file to object_id
Convert the declaration and definition of pretend_sha1_file to use
struct object_id and adjust all usages of this function. Rename it to
pretend_object_file.
Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sha1_file.c b/sha1_file.c index 3da70ac..830b93b 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1312,13 +1312,13 @@ static void *read_object(const unsigned char *sha1, enum object_type *type, return content; } -int pretend_sha1_file(void *buf, unsigned long len, enum object_type type, - unsigned char *sha1) +int pretend_object_file(void *buf, unsigned long len, enum object_type type, + struct object_id *oid) { struct cached_object *co; - hash_sha1_file(buf, len, typename(type), sha1); - if (has_sha1_file(sha1) || find_cached_object(sha1)) + hash_sha1_file(buf, len, typename(type), oid->hash); + if (has_sha1_file(oid->hash) || find_cached_object(oid->hash)) return 0; ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc); co = &cached_objects[cached_object_nr++]; @@ -1326,7 +1326,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type, co->type = type; co->buf = xmalloc(len); memcpy(co->buf, buf, len); - hashcpy(co->sha1, sha1); + hashcpy(co->sha1, oid->hash); return 0; } |