Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-26 Thread Karthik Nayak
On Wed, 2015-02-25 at 16:55 -0500, Eric Sunshine wrote: I had written a longer review but was interrupted for a several hours, and upon returning found that David and Junio covered many of the same issues or overrode comments I was making, so the below review is pared down quite a bit. Junio's

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread David Turner
On Thu, 2015-02-26 at 01:29 +0530, karthik nayak wrote: On 02/25/2015 11:52 PM, David Turner wrote: On Wed, 2015-02-25 at 16:37 +0530, Karthik Nayak wrote: + unsigned long mapsize; ... + map = map_sha1_file(sha1, mapsize); I know this is a pre-existing issue, but I'm not sure

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread karthik nayak
On 02/25/2015 11:52 PM, David Turner wrote: On Wed, 2015-02-25 at 16:37 +0530, Karthik Nayak wrote: + unsigned long mapsize; ... + map = map_sha1_file(sha1, mapsize); I know this is a pre-existing issue, but I'm not sure unsigned long is the right type here. Shouldn't it be a

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread David Turner
On Wed, 2015-02-25 at 16:37 +0530, Karthik Nayak wrote: + unsigned long mapsize; ... + map = map_sha1_file(sha1, mapsize); I know this is a pre-existing issue, but I'm not sure unsigned long is the right type here. Shouldn't it be a size_t? + if (!map) + return

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread Junio C Hamano
Karthik Nayak karthik@gmail.com writes: +int sha1_object_type_literally(const unsigned char *sha1, char *type) +{ + int status = 0; + unsigned long mapsize; + void *map; + git_zstream stream; + char hdr[32]; + int i; + + map = map_sha1_file(sha1,

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread Eric Sunshine
I had written a longer review but was interrupted for a several hours, and upon returning found that David and Junio covered many of the same issues or overrode comments I was making, so the below review is pared down quite a bit. Junio's proposed approach negates all of the below review comments,

Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Looking at how we collect information on normal objects, it may make more sense to model this after sha1_loose_object_info(), with a tweak to struct object_info datatype, and integrate it into sha1_object_info_extended() may make more sense, perhaps

[PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

2015-02-25 Thread Karthik Nayak
sha1_object_type_literally takes a sha value and gives the type of the given loose object, used by git cat-file -t --literally. Signed-off-by: Karthik Nayak karthik@gmail.com --- cache.h | 1 + sha1_file.c | 27 +++ 2 files changed, 28 insertions(+) diff --git