aboutsummaryrefslogtreecommitdiffstats
path: root/object-store.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:08 -0700
committerJunio C Hamano <gitster@pobox.com>2025-05-27 13:59:08 -0700
commit17d9dbd3c270aaa33487f6a03d128c47aea6b309 (patch)
tree6db3c18e3e2c5ba09abbc87ea85a064a6e3cddf2 /object-store.c
parentb6fa7fbcd1b6791675c0b36636745e467419a522 (diff)
parent141f8c8c0535004fa5432d9a6d57bf08129a7dd8 (diff)
downloadgit-17d9dbd3c270aaa33487f6a03d128c47aea6b309.tar.gz
Merge branch 'jk/no-funny-object-types'
Support to create a loose object file with unknown object type has been dropped. * jk/no-funny-object-types: object-file: drop support for writing objects with unknown types hash-object: handle --literally with OPT_NEGBIT hash-object: merge HASH_* and INDEX_* flags hash-object: stop allowing unknown types t: add lib-loose.sh t/helper: add zlib test-tool oid_object_info(): drop type_name strbuf fsck: stop using object_info->type_name strbuf oid_object_info_convert(): stop using string for object type cat-file: use type enum instead of buffer for -t option object-file: drop OBJECT_INFO_ALLOW_UNKNOWN_TYPE flag cat-file: make --allow-unknown-type a noop object-file.h: fix typo in variable declaration
Diffstat (limited to 'object-store.c')
-rw-r--r--object-store.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/object-store.c b/object-store.c
index 517f1fd145..58cde0313a 100644
--- a/object-store.c
+++ b/object-store.c
@@ -646,8 +646,6 @@ static int do_oid_object_info_extended(struct repository *r,
*(oi->disk_sizep) = 0;
if (oi->delta_base_oid)
oidclr(oi->delta_base_oid, the_repository->hash_algo);
- if (oi->type_name)
- strbuf_addstr(oi->type_name, type_name(co->type));
if (oi->contentp)
*oi->contentp = xmemdupz(co->buf, co->size);
oi->whence = OI_CACHED;
@@ -727,7 +725,7 @@ static int oid_object_info_convert(struct repository *r,
{
const struct git_hash_algo *input_algo = &hash_algos[input_oid->algo];
int do_die = flags & OBJECT_INFO_DIE_IF_CORRUPT;
- struct strbuf type_name = STRBUF_INIT;
+ enum object_type type;
struct object_id oid, delta_base_oid;
struct object_info new_oi, *oi;
unsigned long size;
@@ -753,7 +751,7 @@ static int oid_object_info_convert(struct repository *r,
if (input_oi->sizep || input_oi->contentp) {
new_oi.contentp = &content;
new_oi.sizep = &size;
- new_oi.type_name = &type_name;
+ new_oi.typep = &type;
}
oi = &new_oi;
}
@@ -766,12 +764,7 @@ static int oid_object_info_convert(struct repository *r,
if (new_oi.contentp) {
struct strbuf outbuf = STRBUF_INIT;
- enum object_type type;
- type = type_from_string_gently(type_name.buf, type_name.len,
- !do_die);
- if (type == -1)
- return -1;
if (type != OBJ_BLOB) {
ret = convert_object_file(the_repository, &outbuf,
the_hash_algo, input_algo,
@@ -788,10 +781,8 @@ static int oid_object_info_convert(struct repository *r,
*input_oi->contentp = content;
else
free(content);
- if (input_oi->type_name)
- *input_oi->type_name = type_name;
- else
- strbuf_release(&type_name);
+ if (input_oi->typep)
+ *input_oi->typep = type;
}
if (new_oi.delta_base_oid == &delta_base_oid) {
if (repo_oid_to_algop(r, &delta_base_oid, input_algo,