Unified · Split
| @@ -45,11 +45,13 @@ pub(crate) mod function { · 44 unmodified lines | ||
| 45 | 45 | let url: gix::Url = url.as_ref().try_into()?; |
| 46 | 46 | let directory = directory.map_or_else( |
| 47 | 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") | |
| 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") | |
| 53 | 55 | }, |
| 54 | 56 | |dir| Ok(dir.into()), |
| 55 | 57 | )?; |