Re: [PATCH 3/3] improved validation of entry type in mktree

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

 



On Wed, May 13, 2009 at 11:24 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> +     struct strbuf p_uq = STRBUF_INIT;
>>       if (line_termination && path[0] == '"') {
>> -             struct strbuf p_uq = STRBUF_INIT;
>
> Why make its lifetime longer even though you do not use it outside of this
> block?

Sorry, no need. Similar confusion cleared up in patch 1.

>> +	enum object_type obj_type = sha1_object_info(sha1, NULL);
>> +     if (obj_type < 0) {
>> +             if (!allow_missing) {
>
> This is the other way around; when allow_missing is given you shouldn't
> even consult the object database to read it.

I think mktree should verify the object types for objects that are available.

For example (given that 4b825d is empty tree and e69de2 is empty
blob), mktree should reject the following entries:

100644 blob 4b825dc642cb6eb9a060e54bf8d69288fbee4904	foo
040000 tree e69de29bb2d1d6434b8b29ae775ad8c2e48c5391	bar

I don't think the '--missing' option should cause mktree to accept a
tree which is clearly invalid.

Furthermore even with '--missing', a tree entry like this should be rejected:
160000 commit e69de29bb2d1d6434b8b29ae775ad8c2e48c5391  foo
--
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]