Skip to content

Commit cf09832

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 89b43f8 commit cf09832

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

hash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
181181

182182
struct object_id {
183183
unsigned char hash[GIT_MAX_RAWSZ];
184+
int algo;
184185
};
185186

186187
#define the_hash_algo the_repository->hash_algo

0 commit comments

Comments
 (0)