Derive name even if path doesn't canonicalize

This commit is contained in:
Joscha 2023-08-17 15:47:43 +02:00
parent 96e5881665
commit b25d8a6b5c

View file

@ -133,7 +133,7 @@ impl ServerConfig {
fn repo_name(args: &Args) -> String { fn repo_name(args: &Args) -> String {
if let Command::Server(cmd) = &args.command { if let Command::Server(cmd) = &args.command {
if let Some(path) = &cmd.repo { if let Some(path) = &cmd.repo {
if let Ok(path) = path.canonicalize() { let path = path.canonicalize().unwrap_or(path.clone());
if let Some(name) = path.file_name() { if let Some(name) = path.file_name() {
let name = name.to_string_lossy(); let name = name.to_string_lossy();
let name = name.strip_suffix(".git").unwrap_or(&name).to_string(); let name = name.strip_suffix(".git").unwrap_or(&name).to_string();
@ -141,7 +141,6 @@ impl ServerConfig {
} }
} }
} }
}
"unnamed repo".to_string() "unnamed repo".to_string()
} }