git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Felipe Contreras" <felipe.contreras@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] fast-import: add special '-' blob reference to use the previous one.
Date: Mon, 22 Dec 2008 04:08:28 +0200	[thread overview]
Message-ID: <94a0d4530812211808r147cbd40na7266abe5ac0e6f3@mail.gmail.com> (raw)
In-Reply-To: <20081221221149.GB17355@spearce.org>

On Mon, Dec 22, 2008 at 12:11 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> wrote:
>> @@ -1862,7 +1864,7 @@ static void file_change_m(struct branch *b)
>>       const char *endp;
>>       struct object_entry *oe = oe;
>>       unsigned char sha1[20];
>> -     uint16_t mode, inline_data = 0;
>> +     uint16_t mode, inline_data = 0, empty_blob = 0;
>
> Its not the empty blob, its the inherited/assumed blob...

Right. I thought: in order to use the inherited blob, you should not
specify any blob (leave it empty, or blank).

But yeah, 'inherited' does the job too.

>> @@ -1893,6 +1895,10 @@ static void file_change_m(struct branch *b)
>>       } else if (!prefixcmp(p, "inline")) {
>>               inline_data = 1;
>>               p += 6;
>> +     } else if (!prefixcmp(p, "- ")) {
>> +             hashclr(sha1);
>> +             empty_blob = 1;
>> +             p += 1;
>
> Hmph, so if create a new path with a blob of "-" the repository
> will be corrupt because the zero id was used and error was produced.
>
> Actually I think you have the same bug in the prior patch with the
> mode being inherited.  I wonder if we shouldn't put error checking
> in too to validate that versions[0] describes a file entry.

Yes, in my tests I found that issue in the previous patch and I have a
fix for that (set a default mode), but I haven't fixed this one. Do
you know what should be the behavior? I think it should 'die'.

-- 
Felipe Contreras

  parent reply	other threads:[~2008-12-22  2:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-21  2:11 [PATCH 1/2] fast-import: add special mode; copy from parent Felipe Contreras
2008-12-21  2:11 ` [PATCH 2/2] fast-import: add special '-' blob reference to use the previous one Felipe Contreras
2008-12-21 22:11   ` Shawn O. Pearce
2008-12-21 22:24     ` Junio C Hamano
2008-12-21 22:33       ` Shawn O. Pearce
2008-12-22  2:10         ` Felipe Contreras
2008-12-22  2:08     ` Felipe Contreras [this message]
2008-12-21 22:07 ` [PATCH 1/2] fast-import: add special mode; copy from parent Shawn O. Pearce
2008-12-22  2:23   ` Felipe Contreras
2008-12-22  2:25 ` Felipe Contreras

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=94a0d4530812211808r147cbd40na7266abe5ac0e6f3@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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).