Re: [PATCH v3 2/3] sha1_file: implement changes for "cat-file --literally -t"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



karthik nayak <karthik.188@xxxxxxxxx> writes:

> On 03/07/2015 12:58 AM, Junio C Hamano wrote:
>
> case 't':
> 	oi.typep = &type;
> 	oi.typename = &sb;
> 	sha1_object_info_extended(sha1, &oi, flags);
> 	if (sb.len) {
> 		printf("%s\n", sb.buf);
> 		strbuf_release(&sb);
> 		return 0;
> 	} else if (type) {
> 		printf("%s\n", typename(type));
> 		return 0;
> 	}
> 	break;
>
> This works but I need an else statement to check the type if not
> getting the type literally, which is because if not called literally
> the oi.typename is not set,...

Hmph, when I outlined that change to object-info-extended, I meant
to do it in such a way that when the optional oi->typename is set,
it is always filled whether "literally" is asked for andr whether
the object is a kosher one or a bogus one.

Without parsing the header, we wouldn't know how long the object
would be, so I do not know if not doing some variant of parse_header
is an option.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]