Re: [PATCH v3 3/6] create .git/refs in files-backend.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 05, 2020 at 12:42:10PM +0100, SZEDER Gábor wrote:

> On Tue, Feb 04, 2020 at 08:27:37PM +0000, Han-Wen Nienhuys via GitGitGadget wrote:
> > From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
> > 
> > This prepares for supporting the reftable format, which will want
> > create its own file system layout in .git
> 
> This breaks 'git init', and, consequently, the whole test suite:
> 
>   $ ./git init /tmp/foo
>   /tmp/foo/.git/refs/tmp/foo/.git/refs/heads: No such file or directory

Yeah, this is one of the fixes in the patch I sent earlier in the
thread. The issue is here:

> > @@ -3158,6 +3158,11 @@ static int files_init_db(struct ref_store *ref_store, struct strbuf *err)
> >  		files_downcast(ref_store, REF_STORE_WRITE, "init_db");
> >  	struct strbuf sb = STRBUF_INIT;
> >  
> > +	files_ref_path(refs, &sb, "refs");
> > +	safe_create_dir(sb.buf, 1);
> > +        /* adjust permissions even if directory already exists. */
> > +	adjust_shared_perm(sb.buf);
> > +
> >  	/*
> >  	 * Create .git/refs/{heads,tags}
> >  	 */

Right after this context, we call files_ref_path() with "sb" again.
There needs to be a strbuf_reset() beforehand.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux