sha1_file: convert hash_sha1_file to object_id

Convert the declaration and definition of hash_sha1_file to use
struct object_id and adjust all function calls.

Rename this function to hash_object_file.

Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patryk Obara
2018-01-28 01:13:13 +01:00
committed by Junio C Hamano
parent 4b33e60201
commit f070faccc1
11 changed files with 36 additions and 35 deletions

View File

@ -400,15 +400,14 @@ static int update_one(struct cache_tree *it,
}
if (repair) {
unsigned char sha1[20];
hash_sha1_file(buffer.buf, buffer.len, tree_type, sha1);
if (has_sha1_file(sha1))
hashcpy(it->oid.hash, sha1);
struct object_id oid;
hash_object_file(buffer.buf, buffer.len, tree_type, &oid);
if (has_sha1_file(oid.hash))
oidcpy(&it->oid, &oid);
else
to_invalidate = 1;
} else if (dryrun)
hash_sha1_file(buffer.buf, buffer.len, tree_type,
it->oid.hash);
hash_object_file(buffer.buf, buffer.len, tree_type, &it->oid);
else if (write_sha1_file(buffer.buf, buffer.len, tree_type, it->oid.hash)) {
strbuf_release(&buffer);
return -1;