From 2dcde20e1c55fc2e3f9e9e6d48e93c39ec5661d2 Mon Sep 17 00:00:00 2001 From: Matheus Tavares Date: Thu, 30 Jan 2020 17:32:22 -0300 Subject: 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 Signed-off-by: Junio C Hamano --- dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 7d255227b1..512c5d7ea6 100644 --- a/dir.c +++ b/dir.c @@ -1002,8 +1002,8 @@ static int add_patterns(const char *fname, const char *base, int baselen, oidcpy(&oid_stat->oid, &istate->cache[pos]->oid); else - hash_object_file(buf, size, "blob", - &oid_stat->oid); + hash_object_file(the_hash_algo, buf, size, + "blob", &oid_stat->oid); fill_stat_data(&oid_stat->stat, &st); oid_stat->valid = 1; } -- cgit v1.2.3