summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorMatheus Tavares <matheus.bernardino@usp.br>2020-01-30 20:32:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-31 18:45:39 (GMT)
commitb98d18858187eb926912d5199533a6d2a14d5007 (patch)
tree11390f92d70b5c1f1b185004e4c394203768a712 /object.c
parent2dcde20e1c55fc2e3f9e9e6d48e93c39ec5661d2 (diff)
downloadgit-b98d18858187eb926912d5199533a6d2a14d5007.zip
git-b98d18858187eb926912d5199533a6d2a14d5007.tar.gz
git-b98d18858187eb926912d5199533a6d2a14d5007.tar.bz2
sha1-file: allow check_object_signature() to handle any repo
Some callers of check_object_signature() can work on arbitrary repositories, but the repo does not get passed to this function. Instead, the_repository is always used internally. To fix possible inconsistencies, allow the function to receive a struct repository and make those callers pass on the repo being handled. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object.c')
-rw-r--r--object.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/object.c b/object.c
index 142ef69..81f5820 100644
--- a/object.c
+++ b/object.c
@@ -262,7 +262,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) ||
(!obj && repo_has_object_file(r, oid) &&
oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
- if (check_object_signature(repl, NULL, 0, NULL) < 0) {
+ if (check_object_signature(r, repl, NULL, 0, NULL) < 0) {
error(_("hash mismatch %s"), oid_to_hex(oid));
return NULL;
}
@@ -272,7 +272,8 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
buffer = repo_read_object_file(r, oid, &type, &size);
if (buffer) {
- if (check_object_signature(repl, buffer, size, type_name(type)) < 0) {
+ if (check_object_signature(r, repl, buffer, size,
+ type_name(type)) < 0) {
free(buffer);
error(_("hash mismatch %s"), oid_to_hex(repl));
return NULL;