hash: require hash algorithm in oidread() and oidclr()
Both `oidread()` and `oidclr()` use `the_repository` to derive the hash function that shall be used. Require callers to pass in the hash algorithm to get rid of this implicit dependency. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f4836570a7
commit
9da95bda74
6
diff.c
6
diff.c
@@ -4567,7 +4567,7 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is
|
||||
if (!one->oid_valid) {
|
||||
struct stat st;
|
||||
if (one->is_stdin) {
|
||||
oidclr(&one->oid);
|
||||
oidclr(&one->oid, the_repository->hash_algo);
|
||||
return;
|
||||
}
|
||||
if (lstat(one->path, &st) < 0)
|
||||
@@ -4577,7 +4577,7 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is
|
||||
}
|
||||
}
|
||||
else
|
||||
oidclr(&one->oid);
|
||||
oidclr(&one->oid, the_repository->hash_algo);
|
||||
}
|
||||
|
||||
static void strip_prefix(int prefix_length, const char **namep, const char **otherp)
|
||||
@@ -6404,7 +6404,7 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid
|
||||
the_hash_algo->init_fn(&ctx);
|
||||
memset(&data, 0, sizeof(struct patch_id_t));
|
||||
data.ctx = &ctx;
|
||||
oidclr(oid);
|
||||
oidclr(oid, the_repository->hash_algo);
|
||||
|
||||
for (i = 0; i < q->nr; i++) {
|
||||
xpparam_t xpp;
|
||||
|
||||
Reference in New Issue
Block a user