diff options
author | Matheus Tavares <matheus.bernardino@usp.br> | 2020-01-30 21:32:22 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-31 19:45:39 +0100 |
commit | 2dcde20e1c55fc2e3f9e9e6d48e93c39ec5661d2 (patch) | |
tree | 9039d3dd520e915bf531c8f2f32190a4a87d9ccd /builtin/unpack-objects.c | |
parent | sha1-file: pass git_hash_algo to write_object_file_prepare() (diff) | |
download | git-2dcde20e1c55fc2e3f9e9e6d48e93c39ec5661d2.tar.xz git-2dcde20e1c55fc2e3f9e9e6d48e93c39ec5661d2.zip |
sha1-file: pass git_hash_algo to hash_object_file()
Allow hash_object_file() to work on arbitrary repos by introducing a
git_hash_algo parameter. Change callers which have a struct repository
pointer in their scope to pass on the git_hash_algo from the said repo.
For all other callers, pass on the_hash_algo, which was already being
used internally at hash_object_file(). This functionality will be used
in the following patch to make check_object_signature() be able to work
on arbitrary repos (which, in turn, will be used to fix an
inconsistency at object.c:parse_object()).
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/unpack-objects.c')
-rw-r--r-- | builtin/unpack-objects.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 9100964667..dd4a75e030 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -265,7 +265,8 @@ static void write_object(unsigned nr, enum object_type type, } else { struct object *obj; int eaten; - hash_object_file(buf, size, type_name(type), &obj_list[nr].oid); + hash_object_file(the_hash_algo, buf, size, type_name(type), + &obj_list[nr].oid); added_object(nr, type, buf, size); obj = parse_object_buffer(the_repository, &obj_list[nr].oid, type, size, buf, |