Skip to content

Commit d295638

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ae0e94 commit d295638

File tree

4 files changed

+2
-12
lines changed

4 files changed

+2
-12
lines changed

object-file.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@ int parse_loose_header(const char *hdr, struct object_info *oi)
403403
}
404404

405405
type = type_from_string_gently(type_buf, type_len, 1);
406-
if (oi->type_name)
407-
strbuf_add(oi->type_name, type_buf, type_len);
408406
if (oi->typep)
409407
*oi->typep = type;
410408

@@ -466,7 +464,7 @@ int loose_object_info(struct repository *r,
466464
* return value implicitly indicates whether the
467465
* object even exists.
468466
*/
469-
if (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {
467+
if (!oi->typep && !oi->sizep && !oi->contentp) {
470468
struct stat st;
471469
if (!oi->disk_sizep && (flags & OBJECT_INFO_QUICK))
472470
return quick_has_loose(r, oid) ? 0 : -1;

object-store.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,6 @@ static int do_oid_object_info_extended(struct repository *r,
646646
*(oi->disk_sizep) = 0;
647647
if (oi->delta_base_oid)
648648
oidclr(oi->delta_base_oid, the_repository->hash_algo);
649-
if (oi->type_name)
650-
strbuf_addstr(oi->type_name, type_name(co->type));
651649
if (oi->contentp)
652650
*oi->contentp = xmemdupz(co->buf, co->size);
653651
oi->whence = OI_CACHED;

object-store.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ struct object_info {
205205
unsigned long *sizep;
206206
off_t *disk_sizep;
207207
struct object_id *delta_base_oid;
208-
struct strbuf *type_name;
209208
void **contentp;
210209

211210
/* Response */

packfile.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,17 +1598,12 @@ int packed_object_info(struct repository *r, struct packed_git *p,
15981598
*oi->disk_sizep = pack_pos_to_offset(p, pos + 1) - obj_offset;
15991599
}
16001600

1601-
if (oi->typep || oi->type_name) {
1601+
if (oi->typep) {
16021602
enum object_type ptot;
16031603
ptot = packed_to_object_type(r, p, obj_offset,
16041604
type, &w_curs, curpos);
16051605
if (oi->typep)
16061606
*oi->typep = ptot;
1607-
if (oi->type_name) {
1608-
const char *tn = type_name(ptot);
1609-
if (tn)
1610-
strbuf_addstr(oi->type_name, tn);
1611-
}
16121607
if (ptot < 0) {
16131608
type = OBJ_BAD;
16141609
goto out;

0 commit comments

Comments
 (0)