Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh remoting: Expand tilde on host side #18333

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/project/src/worktree_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ impl WorktreeStore {
) -> Task<Result<Model<Worktree>, Arc<anyhow::Error>>> {
let mut abs_path = abs_path.as_ref().to_string_lossy().to_string();
// If we start with `/~` that means the ssh path was something like `ssh://user@host/~/home-dir-folder/`
// in which case want to strip the leading the `/` and expand the tilde.
// in which case want to strip the leading the `/`.
// On the host-side, the `~` will get expanded.
// That's what git does too: https://github.com/libgit2/libgit2/issues/3345#issuecomment-127050850
if abs_path.starts_with("/~") {
abs_path = shellexpand::tilde(&abs_path[1..]).to_string();
abs_path = abs_path[1..].to_string();
}
let root_name = PathBuf::from(abs_path.clone())
.file_name()
Expand Down
9 changes: 8 additions & 1 deletion crates/recent_projects/src/ssh_connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,14 @@ impl SshClientDelegate {
cx,
)
.await
.map_err(|e| anyhow::anyhow!("failed to download remote server binary: {}", e))?;
.map_err(|e| {
anyhow::anyhow!(
"failed to download remote server binary (os: {}, arch: {}): {}",
platform.os,
platform.arch,
e
)
})?;

Ok((binary_path, version))
}
Expand Down
Loading