]> git.proxmox.com Git - cargo.git/commitdiff
Fix #4370 - init panic in C:\ or /
authorParker Snell <parkersnell@gmail.com>
Mon, 14 Aug 2017 18:02:07 +0000 (11:02 -0700)
committerParker Snell <parkersnell@gmail.com>
Mon, 14 Aug 2017 18:02:07 +0000 (11:02 -0700)
src/cargo/ops/cargo_new.rs

index eddcd433c2546a89912cae08f59c5185fb87c2ff..a52029486bd1690b4ea659b0b856b5decaa62fee 100644 (file)
@@ -403,7 +403,7 @@ fn mk(config: &Config, opts: &MkOptions) -> CargoResult<()> {
         if !opts.bin { "glob:Cargo.lock\n" } else { "" }]
         .concat();
 
-    let in_existing_vcs_repo = existing_vcs_repo(path.parent().unwrap(), config.cwd());
+    let in_existing_vcs_repo = existing_vcs_repo(path.parent().unwrap_or(path), config.cwd());
     let vcs = match (opts.version_control, cfg.version_control, in_existing_vcs_repo) {
         (None, None, false) => VersionControl::Git,
         (None, Some(option), false) => option,