git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Micich <josh.micich@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Josh Micich <josh.micich@gmail.com>
Subject: Re: [PATCH 3/3] improved validation of entry type in mktree
Date: Thu, 14 May 2009 15:46:04 -0700	[thread overview]
Message-ID: <a644352c0905141546w4193d45aq4940e72bbb4bda1c@mail.gmail.com> (raw)
In-Reply-To: <7vd4acxkug.fsf@alter.siamese.dyndns.org>

On Wed, May 13, 2009 at 11:24 PM, Junio C Hamano <gitster@pobox.com> 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

  reply	other threads:[~2009-05-14 22:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14  5:06 Proposed patch for mktree [0/3] Josh Micich
2009-05-14  5:09 ` [PATCH 1/3] '--missing' option for mktree: re-added strbuf_release(&p_uq), Updated man page Josh Micich
2009-05-14  6:04   ` Junio C Hamano
2009-05-14 19:44     ` Josh Micich
2009-05-14  5:10 ` [PATCH 2/3] added --batch option to mktree Josh Micich
2009-05-14  6:18   ` Junio C Hamano
2009-05-14  9:24     ` Josh Micich
2009-05-14 10:25       ` Sverre Rabbelier
2009-05-14 19:51         ` Josh Micich
     [not found]     ` <a644352c0905140217h382a4d18h988b229c12577de3@mail.gmail.com>
2009-05-15  8:31       ` Junio C Hamano
2009-05-14  5:11 ` [PATCH 3/3] improved validation of entry type in mktree Josh Micich
2009-05-14  6:24   ` Junio C Hamano
2009-05-14 22:46     ` Josh Micich [this message]
2009-05-14 22:49       ` Josh Micich
2009-05-15  6:23       ` Jakub Narebski
2009-05-15 16:57         ` Josh Micich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a644352c0905141546w4193d45aq4940e72bbb4bda1c@mail.gmail.com \
    --to=josh.micich@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).