From: Michal Suchánek Date: Mon, 18 Feb 2019 08:54:23 GMT Subject: Re: [PATCH 2/2] setup: don't fail if commondir is deleted. Message-ID: <20190218095423.0705aa7a@naga> In-Reply-To: On Sun, 17 Feb 2019 02:14:14 -0500 Eric Sunshine wrote: > On Fri, Feb 15, 2019 at 1:16 PM Michal Suchanek wrote: > > When adding wotktrees git can die in get_common_dir_noenv while > > examining existing worktrees because the commondir file does not exist. > > Handle ENOENT so adding a worktree does not fail because of incompletely > > set-up other worktree. > > > > Signed-off-by: Michal Suchanek > > --- > > diff --git a/setup.c b/setup.c > > @@ -274,22 +274,25 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir) > > + if (strbuf_read_file(&data, path.buf, 0) <= 0) { > > + if (errno != ENOENT) > > + die_errno(_("failed to read %s"), path.buf); > > Documentation for strbuf_read_file() in strbuf.h does not state that > 'errno' has any meaningful value when this function fails, however, It is stated in the documentation of strbuf_read(). Thanks Michal