We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 20dce42 + 0bc9568 commit 401b73dCopy full SHA for 401b73d
gitoxide-core/src/repository/clone.rs
@@ -45,11 +45,13 @@ pub(crate) mod function {
45
let url: gix::Url = url.as_ref().try_into()?;
46
let directory = directory.map_or_else(
47
|| {
48
- gix::path::from_bstr(Cow::Borrowed(url.path.as_ref()))
49
- .as_ref()
50
- .file_stem()
51
- .map(Into::into)
52
- .context("Filename extraction failed - path too short")
+ let path = gix::path::from_bstr(Cow::Borrowed(url.path.as_ref()));
+ if !bare && path.extension() == Some(OsStr::new("git")) {
+ path.file_stem().map(Into::into)
+ } else {
+ path.file_name().map(Into::into)
53
+ }
54
+ .context("Filename extraction failed - path too short")
55
},
56
|dir| Ok(dir.into()),
57
)?;
0 commit comments