summaryrefslogtreecommitdiffstats
path: root/match-trees.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-14 08:49:50 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-14 19:26:32 +0200
commitf4836570a7adbd8c70ad7a8edf6ae5a977647c06 (patch)
tree568c8b46cc7324a45e2c1d42f07ed80b36bf1230 /match-trees.c
parenthash: drop (mostly) unused `is_empty_{blob,tree}_sha1()` functions (diff)
downloadgit-f4836570a7adbd8c70ad7a8edf6ae5a977647c06.tar.xz
git-f4836570a7adbd8c70ad7a8edf6ae5a977647c06.zip
hash: require hash algorithm in `hasheq()`, `hashcmp()` and `hashclr()`
Many of our hash functions have two variants, one receiving a `struct git_hash_algo` and one that derives it via `the_repository`. Adapt all of those functions to always require the hash algorithm as input and drop the variants that do not accept one. As those functions are now independent of `the_repository`, we can move them from "hash.h" to "hash-ll.h". Note that both in this and subsequent commits in this series we always just pass `the_repository->hash_algo` as input even if it is obvious that there is a repository in the context that we should be using the hash from instead. This is done to be on the safe side and not introduce any regressions. All callsites should eventually be amended to use a repo passed via parameters, but this is outside the scope of this patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'match-trees.c')
-rw-r--r--match-trees.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/match-trees.c b/match-trees.c
index 3412b6a140..849b391d3d 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -237,7 +237,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
} else {
rewrite_with = oid2;
}
- hashcpy(rewrite_here, rewrite_with->hash);
+ hashcpy(rewrite_here, rewrite_with->hash, the_repository->hash_algo);
status = write_object_file(buf, sz, OBJ_TREE, result);
free(buf);
return status;