git.object_info

git

object_info(git_dir, sha_hex) -> type, size

Report an object's type and size, without its content

Returns the type, "commit", "tree", "blob" or "tag", and the size of the content, as read_object would give them. Returns nil when the object is not found. Headers answer it: a packed plain entry inflates nothing, a packed delta and a loose object inflate their first 32 bytes. A delta's type takes one short read per link down its chain. A packed object's answer stays with its pack, so a second ask reads nothing; so does the type of each link a walk passed.