git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] fast-import: add special '-' blob reference to use the previous one.

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 22, 2008, 02:08 UTC
Message-ID
<94a0d4530812211808r147cbd40na7266abe5ac0e6f3@mail.gmail.com>
In-Reply-To
<20081221221149.GB17355@spearce.org>
On Mon, Dec 22, 2008 at 12:11 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 9 quoted lines
> 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.
Show 15 quoted lines
>> @@ -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
Previous: Felipe ContrerasNext: Shawn O. Pearce
Message 7 of 10 in “fast-import: add special mode; copy from parent.”
  1. 1/2 fast-import: add special mode; copy from parent.Felipe Contreras, Dec 21, 2008
  2. 2/2 fast-import: add special '-' blob reference to use the previous one.Felipe Contreras, Dec 21, 2008
  3. Shawn O. PearceDec 21, 2008
  4. Junio C HamanoDec 21, 2008
  5. Shawn O. PearceDec 21, 2008
  6. Felipe ContrerasDec 22, 2008
  7. Felipe ContrerasDec 22, 2008
  8. Shawn O. PearceDec 21, 2008
  9. Felipe ContrerasDec 22, 2008
  10. Felipe ContrerasDec 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.