Because `diag_url` contains the raw protocol string the assertion failed for `ssh+git`/`git+ssh` urls. The problem is that `scheme.as_str()` returns just `ssh` in those cases. By switching the conversion we can circumvent this behavior. Forget the above, I am stupid (currently amending this commit). The problem is that we do not parse `ssh+git`/`git+ssh` as SSH urls - there was nothing wrong with the previous version. Git uses an enum internally for different schemes and converts it to a string for the diagnose output. This is just one case where our parsing differs to the one from Git. Nevertheless, I keep the change, because it made the problem way clearer.
Unified · Split
| @@ -133,7 +133,10 @@ fn baseline() { · 132 unmodified lines | ||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | fn assert_urls_equal(diag_url: &GitDiagUrl<'_>, gix_url: &gix_url::Url) { |
| 136 | − assert_eq!(diag_url.protocol, gix_url.scheme.as_str()); | |
| 136 | + assert_eq!( | |
| 137 | + gix_url::Scheme::from(diag_url.protocol.to_str().unwrap()), | |
| 138 | + gix_url.scheme | |
| 139 | + ); | |
| 137 | 140 | |
| 138 | 141 | match diag_url.host { |
| 139 | 142 | GitDiagHost::NonSsh { host_and_port } => match host_and_port { |