diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-06-14 08:50:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-14 19:26:33 +0200 |
commit | 861e8c76f6668a8cbb764ec0ea3ba425dfb86b2a (patch) | |
tree | 31f293d0b31897958e126e6cc98c2424568550aa /hash.h | |
parent | hash: convert `oidcmp()` and `oideq()` to compare whole hash (diff) | |
download | git-861e8c76f6668a8cbb764ec0ea3ba425dfb86b2a.tar.xz git-861e8c76f6668a8cbb764ec0ea3ba425dfb86b2a.zip |
hash: make `is_null_oid()` independent of `the_repository`
The function `is_null_oid()` uses `oideq(oid, null_oid())` to check
whether a given object ID is the all-zero object ID. `null_oid()`
implicitly relies on `the_repository` though to return the correct null
object ID.
Get rid of this dependency by always comparing the complete hash array
for being all-zeroes. This is possible due to the refactoring of object
IDs so that their hash arrays are always fully initialized.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash.h')
-rw-r--r-- | hash.h | 5 |
1 files changed, 0 insertions, 5 deletions
@@ -6,11 +6,6 @@ #define the_hash_algo the_repository->hash_algo -static inline int is_null_oid(const struct object_id *oid) -{ - return oideq(oid, null_oid()); -} - static inline int is_empty_blob_oid(const struct object_id *oid) { return oideq(oid, the_hash_algo->empty_blob); |