diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2798,13 +2798,14 @@ requirements = newreporequirements(ui, createopts=createopts) wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) - if not wdirvfs.exists(): - wdirvfs.makedirs() hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg')) if hgvfs.exists(): raise error.RepoError(_('repository %s already exists') % path) + if not wdirvfs.exists(): + wdirvfs.makedirs() + hgvfs.makedir(notindexed=True) if b'store' in requirements: