-
-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
I was trying to use the lux-cli and was running into "malformed hostname" from git2-rs and noticed that the parse seemed to change the url in a way I don't think it should
let parsed = GitUrl::parse("git+ssh://git.server.au/my/repo.git").unwrap();
let transformed_url = parsed.to_string();
println!(" Original: {}", original_url);
println!(" Transformed: {}", transformed_url);
Original: ssh://git.server.au/my/repo.git
Transformed: ssh://git.server.au:my/repo.git
it's changed the / after the hostname to :
then trying to use this with git2 will error
use git2::build::RepoBuilder;
...
let temp_dir = format!("/tmp/test-{}", std::process::id());
let mut fetch_opts = FetchOptions::new();
fetch_opts.depth(1);
fetch_opts.update_fetchhead(false);
let mut builder = RepoBuilder::new();
builder.fetch_options(fetch_opts);
match builder.clone(&transformed_url, temp_dir.as_ref()) {
Ok(_) => {
println!(" ✓ Clone succeeded");
let _ = std::fs::remove_dir_all(&temp_dir);
}
Err(e) => {
println!(" ✗ Clone failed");
println!(" Error: {}", e.message());
println!(" Code: InvalidSpec ({})", e.raw_code());
println!(" Class: Net ({})", e.raw_class());
let _ = std::fs::remove_dir_all(&temp_dir);
}
}
}
will error with
✗ Clone failed
Error: invalid url: malformed hostname
Code: InvalidSpec (-12)
Class: Net (12)
Metadata
Metadata
Assignees
Labels
No labels