Skip to content

Commit 401b73d

Browse files
committed
Merge branch 'fix-1177'
2 parents 20dce42 + 0bc9568 commit 401b73d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gitoxide-core/src/repository/clone.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ pub(crate) mod function {
4545
let url: gix::Url = url.as_ref().try_into()?;
4646
let directory = directory.map_or_else(
4747
|| {
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")
48+
let path = gix::path::from_bstr(Cow::Borrowed(url.path.as_ref()));
49+
if !bare && path.extension() == Some(OsStr::new("git")) {
50+
path.file_stem().map(Into::into)
51+
} else {
52+
path.file_name().map(Into::into)
53+
}
54+
.context("Filename extraction failed - path too short")
5355
},
5456
|dir| Ok(dir.into()),
5557
)?;

0 commit comments

Comments
 (0)