collin/anvil · 2f35cebb
Drop the ssh:// prefix from clone URLs on the default port
Collin Richards · 2026-08-18 17:28 UTC · 2f35cebbbbd354d178741ac6c375a3f1dd547905 · parent e922ead7 · browse files
modifiedcrates/anvil-core/src/config.rs+4 −5
| ⋯ 546 unchanged lines | |||
| 547 | 547 | ||
| 548 | 548 | /// The SSH clone URL for `<owner>/<name>`, using the externally advertised | |
| 549 | 549 | /// host/port/user (which may differ from the internal bind under Docker). | |
| 550 | - | /// The port is omitted when it is the SSH default (22). | |
| 550 | + | /// On the SSH default (22), this is the scp-like `user@host:path` form, | |
| 551 | + | /// which needs no `ssh://` scheme or port; a non-default port can only be | |
| 552 | + | /// expressed with the `ssh://` form, so that's used instead. | |
| 551 | 553 | pub fn ssh_clone_url(&self, owner: &str, name: &str) -> String { | |
| 552 | 554 | let ssh = &self.ssh; | |
| 553 | 555 | if ssh.clone_port == 22 { | |
| 554 | - | format!( | |
| 555 | - | "ssh://{}@{}/{owner}/{name}.git", | |
| 556 | - | ssh.clone_user, ssh.clone_host | |
| 557 | - | ) | |
| 556 | + | format!("{}@{}:{owner}/{name}.git", ssh.clone_user, ssh.clone_host) | |
| 558 | 557 | } else { | |
| 559 | 558 | format!( | |
| 560 | 559 | "ssh://{}@{}:{}/{owner}/{name}.git", | |
| ⋯ 125 unchanged lines | |||