Derive name even if path doesn't canonicalize
This commit is contained in:
parent
96e5881665
commit
b25d8a6b5c
1 changed files with 5 additions and 6 deletions
|
|
@ -133,12 +133,11 @@ impl ServerConfig {
|
|||
fn repo_name(args: &Args) -> String {
|
||||
if let Command::Server(cmd) = &args.command {
|
||||
if let Some(path) = &cmd.repo {
|
||||
if let Ok(path) = path.canonicalize() {
|
||||
if let Some(name) = path.file_name() {
|
||||
let name = name.to_string_lossy();
|
||||
let name = name.strip_suffix(".git").unwrap_or(&name).to_string();
|
||||
return name;
|
||||
}
|
||||
let path = path.canonicalize().unwrap_or(path.clone());
|
||||
if let Some(name) = path.file_name() {
|
||||
let name = name.to_string_lossy();
|
||||
let name = name.strip_suffix(".git").unwrap_or(&name).to_string();
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue