summaryrefslogtreecommitdiff
path: root/object-file.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2025-05-16 00:49:50 -0400
committerJunio C Hamano <gitster@pobox.com>2025-05-16 09:43:10 -0700
commitb32b434bfe241cde380c5f3aca48a1fdcd86961b (patch)
tree27aae3654ef295633a4d7e68041be463d2f0d647 /object-file.c
parentaac2abeca7077aa5f87f4132b98d37dd938b3573 (diff)
oid_object_info_convert(): stop using string for object type
In oid_object_info_convert(), we convert objects between their sha1 and sha256 variants. To do this, we naturally need to know the type, which we get from oid_object_info_extended() using its type_name strbuf option. But getting the value as a string (versus an object_type enum) is not helpful. Since we do not allow unknown types, the regular enum is sufficient. And the resulting code is a bit simpler, as we no longer have to manage the extra allocation nor convert the string to an enum ourselves. Note that at first glance, it might seem like we should retain the error check for "type == -1" to catch bogus types found by the underlying parser. But we don't need it, as an unknown type would have yielded an error from the call to oid_object_info_extended(), which would already have caused us to return an error. In fact, I suspect this was always impossible to trigger. Even when we were converting the string to a type enum ourselves, an invalid type would never have escaped oid_object_info_extended(), since we never passed the (now removed) OBJECT_INFO_ALLOW_UNKNOWN_TYPE option. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
0 files changed, 0 insertions, 0 deletions