Skip to content
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
4 changes: 4 additions & 0 deletions app/src/pane_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ pub enum Event {
RemoteRepoNavigated {
host_id: HostId,
indexed_path: String,
/// Whether the server detected a git repository at this path.
is_git: bool,
},
/// Refresh the workspace-level active session state.
ActiveSessionChanged,
Expand Down Expand Up @@ -4129,10 +4131,12 @@ impl PaneGroup {
PaneEvent::RemoteRepoNavigated {
host_id,
indexed_path,
is_git,
} => {
ctx.emit(Event::RemoteRepoNavigated {
host_id: host_id.clone(),
indexed_path: indexed_path.clone(),
is_git: *is_git,
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/pane_group/pane/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,9 @@ pub enum PaneEvent {
RemoteRepoNavigated {
host_id: HostId,
indexed_path: String,
/// Whether the server detected a git repository at this path (drives
/// remote code-review registration).
is_git: bool,
},
/// Split the current pane into two. If `initial_query` is `Some` fill the new pane's input with
/// its value.
Expand Down
3 changes: 2 additions & 1 deletion app/src/terminal/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4162,7 +4162,7 @@ impl TerminalView {
session_id: nav_session_id,
host_id,
indexed_path,
..
is_git,
} => {
// Check if this navigation belongs to our active session
// using exact session_id match (no CWD heuristics).
Expand All @@ -4173,6 +4173,7 @@ impl TerminalView {
ctx.emit(Event::Pane(PaneEvent::RemoteRepoNavigated {
host_id: host_id.clone(),
indexed_path: indexed_path.clone(),
is_git: *is_git,
}));
}
}
Expand Down
38 changes: 37 additions & 1 deletion app/src/workspace/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12851,11 +12851,12 @@ impl Workspace {
pane_group::Event::RemoteRepoNavigated {
host_id,
indexed_path,
is_git,
} => {
use warp_util::standardized_path::StandardizedPath;

if let Ok(std_path) = StandardizedPath::try_new(indexed_path) {
let remote_id = RemoteRepositoryIdentifier::new(host_id.clone(), std_path);
let remote_id = RemoteRepositoryIdentifier::new(host_id.clone(), std_path.clone());
let pane_group_id = pane_group.id();
self.left_panel_view.update(ctx, |left_panel, ctx| {
left_panel.navigate_server_file_browser(
Expand All @@ -12873,6 +12874,41 @@ impl Workspace {
view.set_remote_root_directories(std::slice::from_ref(&remote_id), ctx);
});
}

// When the remote dir is a git repository, register it so the
// code-review panel lists it and can create a remote-backed
// DiffStateModel. The event's warp_core HostId is bridged to
// the warp_util family used by the diff-state remote path.
if *is_git {
let util_host =
crate::code::buffer_location::core_host_id_to_util(host_id);
let remote_path =
warp_util::remote_path::RemotePath::new(util_host, std_path);
repo_metadata::repositories::DetectedRepositories::handle(ctx).update(
ctx,
|repos, _| {
repos.register_remote_repo_root(remote_path.clone());
},
);
if let Some(terminal_id) = pane_group
.as_ref(ctx)
.active_session_view(ctx)
.map(|tv| tv.id())
{
let remote_key =
warp_util::local_or_remote_path::LocalOrRemotePath::Remote(
remote_path,
);
self.working_directories_model.update(ctx, |model, ctx| {
model.register_remote_repo(
pane_group_id,
remote_key,
terminal_id,
ctx,
);
});
}
}
}
}
#[cfg(not(feature = "local_fs"))]
Expand Down
Loading