From: brian m. carlson Date: Mon, 26 Apr 2021 01:02:49 +0000 (+0000) Subject: hash: add an algo member to struct object_id X-Git-Tag: v2.32.0-rc0~31^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf0983213c72727c4c7dea51ed9b3b38a2968fbe;p=thirdparty%2Fgit.git hash: add an algo member to struct object_id Now that we're working with multiple hash algorithms in the same repo, it's best if we label each object ID with its algorithm so we can determine how to format a given object ID. Add a member called algo to struct object_id. Performance testing on object ID-heavy workloads doesn't reveal a clear change in performance. Out of performance tests t0001 and t1450, there are slight variations in performance both up and down, but all measurements are within the margin of error. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- diff --git a/hash.h b/hash.h index 3fb0c3d400..dafdcb3335 100644 --- a/hash.h +++ b/hash.h @@ -181,6 +181,7 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p) struct object_id { unsigned char hash[GIT_MAX_RAWSZ]; + int algo; }; #define the_hash_algo the_repository->hash_algo