diff options
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c index d4ba0c4a4f..884855b9df 100644 --- a/object-file.c +++ b/object-file.c @@ -55,7 +55,6 @@ "\x6f\xe1\x41\xf7\x74\x91\x20\xa3\x03\x72" \ "\x18\x13" -const struct object_id null_oid; static const struct object_id empty_tree_oid = { .hash = EMPTY_TREE_SHA1_BIN_LITERAL, .algo = GIT_HASH_SHA1, @@ -64,6 +63,10 @@ static const struct object_id empty_blob_oid = { .hash = EMPTY_BLOB_SHA1_BIN_LITERAL, .algo = GIT_HASH_SHA1, }; +static const struct object_id null_oid_sha1 = { + .hash = {0}, + .algo = GIT_HASH_SHA1, +}; static const struct object_id empty_tree_oid_sha256 = { .hash = EMPTY_TREE_SHA256_BIN_LITERAL, .algo = GIT_HASH_SHA256, @@ -72,6 +75,10 @@ static const struct object_id empty_blob_oid_sha256 = { .hash = EMPTY_BLOB_SHA256_BIN_LITERAL, .algo = GIT_HASH_SHA256, }; +static const struct object_id null_oid_sha256 = { + .hash = {0}, + .algo = GIT_HASH_SHA256, +}; static void git_hash_sha1_init(git_hash_ctx *ctx) { @@ -172,6 +179,7 @@ const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = { git_hash_unknown_final_oid, NULL, NULL, + NULL, }, { "sha1", @@ -187,6 +195,7 @@ const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = { git_hash_sha1_final_oid, &empty_tree_oid, &empty_blob_oid, + &null_oid_sha1, }, { "sha256", @@ -202,9 +211,15 @@ const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = { git_hash_sha256_final_oid, &empty_tree_oid_sha256, &empty_blob_oid_sha256, + &null_oid_sha256, } }; +const struct object_id *null_oid(void) +{ + return the_hash_algo->null_oid; +} + const char *empty_tree_oid_hex(void) { static char buf[GIT_MAX_HEXSZ + 1]; |