Re: [PATCH v3 3/6] create .git/refs in files-backend.c
From: Jeff King <hidden>
Date: 2020-02-05 12:24:39
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:quoted
From: Han-Wen Nienhuys <redacted> This prepares for supporting the reftable format, which will want create its own file system layout in .gitThis 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:
quoted
@@ -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