Skip to content

Commit ba606d2

Browse files
committed
Auto merge of #7126 - ehuss:beta-git-new-root, r=alexcrichton
[BETA] Fix `cargo new` in root directory. A temporary fix for #7049, master/nightly will (eventually) get the fix by updating libgit2.
2 parents cd1e4bf + 2f12ab6 commit ba606d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cargo/ops/cargo_new.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ fn init_vcs(path: &Path, vcs: VersionControl, config: &Config) -> CargoResult<()
510510
match vcs {
511511
VersionControl::Git => {
512512
if !path.join(".git").exists() {
513+
// Temporary fix to work around bug in libgit2 when creating a
514+
// directory in the root of a posix filesystem.
515+
// See: https://github.com/libgit2/libgit2/issues/5130
516+
fs::create_dir_all(path)?;
513517
GitRepo::init(path, config.cwd())?;
514518
}
515519
}

0 commit comments

Comments
 (0)