From 2f12ab6fb4a29a3ef949358fefdd254b02d0ff75 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 12 Jul 2019 10:35:06 -0700 Subject: [PATCH] [BETA] Fix `cargo new` in root directory. --- src/cargo/ops/cargo_new.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index d72c91f0c21..9f935d1df88 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -510,6 +510,10 @@ fn init_vcs(path: &Path, vcs: VersionControl, config: &Config) -> CargoResult<() match vcs { VersionControl::Git => { if !path.join(".git").exists() { + // Temporary fix to work around bug in libgit2 when creating a + // directory in the root of a posix filesystem. + // See: https://github.com/libgit2/libgit2/issues/5130 + fs::create_dir_all(path)?; GitRepo::init(path, config.cwd())?; } }