Subject: Re: Can't build first git commit

From: Jeff King <[email-masked]>
Date: Wed, 6 Mar 2019 16:57:52 -0500

On Wed, Mar 06, 2019 at 09:52:59PM +0100, Fabio Aiuto wrote:

> Found this error
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00401628 in verify_hdr (hdr=0x0, size=32) at read-cache.c:192
> 192		if (hdr->signature != CACHE_SIGNATURE)
> 
> when tracing on line
> 
> static int verify_hdr(struct cache_header *hdr, unsigned long size)
> {
> 	SHA_CTX c;
> 	unsigned char sha1[20];
> 
> 	if (hdr->signature != CACHE_SIGNATURE)<--- this line
> 
> inside file read-cache.c
> What's going on?

Well, hdr is NULL, so you can't dereference it. Without knowing more
about how you called it, it's hard to say. But do note that the index
format has been updated once or twice (as well as the pack format). You
probably can't just chdir into a clone made by a recent Git and expect
ancient versions to read it.

You'll have to start a repo from scratch, or clone an existing with the
old version (which will be tricky; you might have to use a modern
upload-pack to represent the server side, but I think that first version
doesn't even have any fetch capabilities at all).

It might also be possible to convince modern Git to write out in old
formats that ancient Git will understand, but I don't know the right
config knobs to tweak offhand.

-Peff