Directory creation: dfference in behaviour between MacOS and Windows
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
The following program succeeds on MacOS but fails on Windows 10:
use git2::Repository;
use std::env;
fn main() {
let path = env::current_dir().unwrap();
let path = path.join("foo");
let path = path.join("bar");
let url = "https://github.com/alexcrichton/git2-rs";
match Repository::clone(url, path) {
Ok(repo) => repo,
Err(e) => panic!("failed to clone: {}", e),
};
}
Error on Windows is:
thread 'main' panicked at 'failed to clone: failed to make directory 'C:\Users\myuser.CORP\Code\pathtest\foo\bar': The system cannot find the path specified.
; class=Os (2)', src\main.rs:11:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\pathtest.exe` (exit code: 101)
Seemingly this is due to clone recursively creating directories on MacOS but only being able to create single directories on Windows.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Repository::clone and reproduce the example on Windows 10 using the nested foo/bar destination. Trace how the destination directories are created and compare the Windows and macOS behavior; done means cloning succeeds when the parent directories do not already exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100