Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-07 Thread karthik nayak
On 04/06/2015 01:27 AM, Junio C Hamano wrote: karthik nayak karthik@gmail.com writes: On 04/05/2015 01:16 PM, Junio C Hamano wrote: If it semantically does not make sense to ask for the typename without asking for the type code, then we can and should make that as a new calling

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-07 Thread Eric Sunshine
On Sun, Apr 5, 2015 at 2:28 PM, Karthik Nayak karthik@gmail.com wrote: Update sha1_loose_object_info() to optionally allow it to read from a loose object file of unknown/bogus type; as the function usually returns the type of the object it read in the form of enum for known types, add an

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-05 Thread karthik nayak
On 04/05/2015 01:16 PM, Junio C Hamano wrote: karthik nayak karthik@gmail.com writes: So, it makes me wonder what guarantee we have that this does not dereference a NULL here. As per my code, oi-typename is only pointing to something when oi-typep is ( As oi-typename is currently only

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-05 Thread Junio C Hamano
karthik nayak karthik@gmail.com writes: So, it makes me wonder what guarantee we have that this does not dereference a NULL here. As per my code, oi-typename is only pointing to something when oi-typep is ( As oi-typename is currently only used in cat-file.c). But what you're saying

[PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-05 Thread Karthik Nayak
Update sha1_loose_object_info() to optionally allow it to read from a loose object file of unknown/bogus type; as the function usually returns the type of the object it read in the form of enum for known types, add an optional typename field to receive the name of the type in textual form and a

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-05 Thread Junio C Hamano
karthik nayak karthik@gmail.com writes: On 04/05/2015 01:16 PM, Junio C Hamano wrote: If it semantically does not make sense to ask for the typename without asking for the type code, then we can and should make that as a new calling convention _all_ callers must follow. In other words,

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-04 Thread karthik nayak
On 04/05/2015 01:04 AM, Junio C Hamano wrote: Karthik Nayak karthik@gmail.com writes: @@ -2586,13 +2649,15 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, *(oi-disk_sizep) = 0; if (oi-delta_base_sha1)

Re: [PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-04 Thread Junio C Hamano
Karthik Nayak karthik@gmail.com writes: @@ -2586,13 +2649,15 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, *(oi-disk_sizep) = 0; if (oi-delta_base_sha1) hashclr(oi-delta_base_sha1); +

[PATCH v7 1/4] sha1_file.c: support reading from a loose object of unknown type

2015-04-03 Thread Karthik Nayak
Update sha1_loose_object_info() to optionally allow it to read from a loose object file of unknown/bogus type; as the function usually returns the type of the object it read in the form of enum for known types, add an optional typename field to receive the name of the type in textual form and a