Re: [RFC] git cat-file "literally" option
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 18, 2015, 13:58 UTC
- Message-ID
- <CACsJy8BJnHTyXhhJaCuZAzjm=Gd96EjANEw76j=3L92cmbX7HA@mail.gmail.com>
- In-Reply-To
- <54E48A96.8010301@gmail.com>
On Wed, Feb 18, 2015 at 7:50 PM, karthik nayak <karthik.188@gmail.com> 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