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

Re: Can't build first git commit

From
FAFabio Aiuto <polinice83@libero.it>
Date
Mar 7, 2019, 20:07 UTC
Message-ID
<1551989235.1606.3.camel@libero.it>
In-Reply-To
<20190307194146.GA2453@sigill.intra.peff.net>

Sorry for forgetting the cc!!! Thank you so much for help, hope not to bore you all ;) I think that I will go on studying git this way, and follow all the improvements that were made along his history. I think that asymptosis too gave me a good link, related to that bash script implmentation. Thank you Jeff, now I'm trying to understand how could I show the contents of the index in that version.

Fabio.
Il giorno gio, 07/03/2019 alle 14.41 -0500, Jeff King ha scritto:
Show 58 quoted lines
> [+cc git@vger; let's keep this on the list; I'm not sure there's a
> lot
>  to be learned from fiddling with this old version, but if we're
> going
>  to do it, let's at least record our attempts for posterity]
> 
> On Thu, Mar 07, 2019 at 08:04:55PM +0100, Fabio Aiuto wrote:
> 
> > I made a directory "trial" and inside it I ran init-db (that's the
> > grand-father of git init) inside that directory. Then I created a
> > file 
> > this way:
> > 
> > echo 'helloooo!' >file.txt
> > 
> > then then executed update-cache file.txt (thinking that's the
> > ancestor
> > of git add), but that doesn't work and it returns with a
> > segmentation
> > fault, due to the nullity of the header. But in this first commit
> > how
> > do I add a file in the cache? What's the right way to build up a
> > repository from scratch with commit e83c5163316f?
> 
> Hmm. I tried that, too, and got a segfault. Then I tried it again a
> few
> minutes later, and it worked.
> 
> One thing that seems to provoke it consistently is having a zero-
> length
> index file (because that causes mmap to return NULL, and the code
> does
> not check for that case). Try this:
> 
>   # This works.
>   init-db
>   echo content >file
>   update-cache file
> 
>   # This segfaults
>   >.dircache/index
>   update-cache file
> 
>   # And this works again
>   rm .dircache/index
>   update-cache file
> 
> I'm not sure why it would ever fail without that explicit empty-file
> write. Perhaps there's some code path that writes out an empty index
> file, and we inadvertently triggered it.
> 
> If you're going to play with such an antique commit, you have to
> expect
> that things won't necessarily work, and be ready to poke around in
> the
> debugger.
> 
> -Peff
Previous: Jeff King
Message 18 of 18 in “Can't build first git commit”
  1. Fabio AiutoMar 4, 2019
  2. Santiago TorresMar 4, 2019
  3. Fabio AiutoMar 4, 2019
  4. Santiago TorresMar 4, 2019
  5. asymptosisMar 4, 2019
  6. Jonathan NiederMar 4, 2019
  7. Jeff KingMar 4, 2019
  8. Fabio AiutoMar 5, 2019
  9. Jeff KingMar 5, 2019
  10. Fabio AiutoMar 6, 2019
  11. Jeff KingMar 6, 2019
  12. Fabio AiutoMar 6, 2019
  13. Santiago TorresMar 6, 2019
  14. Jeff KingMar 6, 2019
  15. Fabio AiutoMar 6, 2019
  16. Jeff KingMar 6, 2019
  17. Jeff KingMar 7, 2019
  18. Fabio AiutoMar 7, 2019

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.