From: Duy Nguyen Date: Wed, 18 Feb 2015 13:58:01 GMT Subject: Re: [RFC] git cat-file "literally" option Message-ID: In-Reply-To: <54E48A96.8010301@gmail.com> On Wed, Feb 18, 2015 at 7:50 PM, karthik nayak wrote: > Also, > Is there any way I can get the type of object made via git hash-object > --literally. The problem I'm facing is "sha1_object_info()" returns a > object_type enum, so objects not specified there are considered as errors. Use what sha1_object_info() uses behind the scene. Loose object encodes object type as a string, you could just print that string and skip the enum object_type conversion. You probably need special treatment for packed objects too. See parse_sha1_header() and unpack_object_header(). -- Duy