oid_object_info(): drop type_name strbuf
We provide a mechanism for callers to get the object type as a raw string, rather than an object_type enum. This was in theory useful for returning types that are not representable in the enum, but we consider any such type to be an error, and there are no callers that use the strbuf anymore. Let's drop support to simplify the code a bit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4ae0e9423c
commit
d2956385a9
@@ -403,8 +403,6 @@ int parse_loose_header(const char *hdr, struct object_info *oi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
type = type_from_string_gently(type_buf, type_len, 1);
|
type = type_from_string_gently(type_buf, type_len, 1);
|
||||||
if (oi->type_name)
|
|
||||||
strbuf_add(oi->type_name, type_buf, type_len);
|
|
||||||
if (oi->typep)
|
if (oi->typep)
|
||||||
*oi->typep = type;
|
*oi->typep = type;
|
||||||
|
|
||||||
@@ -466,7 +464,7 @@ int loose_object_info(struct repository *r,
|
|||||||
* return value implicitly indicates whether the
|
* return value implicitly indicates whether the
|
||||||
* object even exists.
|
* object even exists.
|
||||||
*/
|
*/
|
||||||
if (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {
|
if (!oi->typep && !oi->sizep && !oi->contentp) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (!oi->disk_sizep && (flags & OBJECT_INFO_QUICK))
|
if (!oi->disk_sizep && (flags & OBJECT_INFO_QUICK))
|
||||||
return quick_has_loose(r, oid) ? 0 : -1;
|
return quick_has_loose(r, oid) ? 0 : -1;
|
||||||
|
|||||||
@@ -646,8 +646,6 @@ static int do_oid_object_info_extended(struct repository *r,
|
|||||||
*(oi->disk_sizep) = 0;
|
*(oi->disk_sizep) = 0;
|
||||||
if (oi->delta_base_oid)
|
if (oi->delta_base_oid)
|
||||||
oidclr(oi->delta_base_oid, the_repository->hash_algo);
|
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)
|
if (oi->contentp)
|
||||||
*oi->contentp = xmemdupz(co->buf, co->size);
|
*oi->contentp = xmemdupz(co->buf, co->size);
|
||||||
oi->whence = OI_CACHED;
|
oi->whence = OI_CACHED;
|
||||||
|
|||||||
@@ -205,7 +205,6 @@ struct object_info {
|
|||||||
unsigned long *sizep;
|
unsigned long *sizep;
|
||||||
off_t *disk_sizep;
|
off_t *disk_sizep;
|
||||||
struct object_id *delta_base_oid;
|
struct object_id *delta_base_oid;
|
||||||
struct strbuf *type_name;
|
|
||||||
void **contentp;
|
void **contentp;
|
||||||
|
|
||||||
/* Response */
|
/* Response */
|
||||||
|
|||||||
@@ -1598,17 +1598,12 @@ int packed_object_info(struct repository *r, struct packed_git *p,
|
|||||||
*oi->disk_sizep = pack_pos_to_offset(p, pos + 1) - obj_offset;
|
*oi->disk_sizep = pack_pos_to_offset(p, pos + 1) - obj_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oi->typep || oi->type_name) {
|
if (oi->typep) {
|
||||||
enum object_type ptot;
|
enum object_type ptot;
|
||||||
ptot = packed_to_object_type(r, p, obj_offset,
|
ptot = packed_to_object_type(r, p, obj_offset,
|
||||||
type, &w_curs, curpos);
|
type, &w_curs, curpos);
|
||||||
if (oi->typep)
|
if (oi->typep)
|
||||||
*oi->typep = ptot;
|
*oi->typep = ptot;
|
||||||
if (oi->type_name) {
|
|
||||||
const char *tn = type_name(ptot);
|
|
||||||
if (tn)
|
|
||||||
strbuf_addstr(oi->type_name, tn);
|
|
||||||
}
|
|
||||||
if (ptot < 0) {
|
if (ptot < 0) {
|
||||||
type = OBJ_BAD;
|
type = OBJ_BAD;
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
Reference in New Issue
Block a user