Add support for git branches on remote projects (#19755)
Release Notes: - Fixed a bug where the branch switcher could not be used remotely.
This commit is contained in:
parent
5506669b06
commit
c69da2df70
25 changed files with 993 additions and 127 deletions
|
@ -288,6 +288,13 @@ impl ProjectPath {
|
|||
path: self.path.to_string_lossy().to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn root_path(worktree_id: WorktreeId) -> Self {
|
||||
Self {
|
||||
worktree_id,
|
||||
path: Path::new("").into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
@ -701,7 +708,7 @@ impl Project {
|
|||
|
||||
let ssh_proto = ssh.read(cx).proto_client();
|
||||
let worktree_store =
|
||||
cx.new_model(|_| WorktreeStore::remote(false, ssh_proto.clone(), 0));
|
||||
cx.new_model(|_| WorktreeStore::remote(false, ssh_proto.clone(), SSH_PROJECT_ID));
|
||||
cx.subscribe(&worktree_store, Self::on_worktree_store_event)
|
||||
.detach();
|
||||
|
||||
|
@ -3370,6 +3377,25 @@ impl Project {
|
|||
worktree.get_local_repo(&root_entry)?.repo().clone().into()
|
||||
}
|
||||
|
||||
pub fn branches(
|
||||
&self,
|
||||
project_path: ProjectPath,
|
||||
cx: &AppContext,
|
||||
) -> Task<Result<Vec<git::repository::Branch>>> {
|
||||
self.worktree_store().read(cx).branches(project_path, cx)
|
||||
}
|
||||
|
||||
pub fn update_or_create_branch(
|
||||
&self,
|
||||
repository: ProjectPath,
|
||||
new_branch: String,
|
||||
cx: &AppContext,
|
||||
) -> Task<Result<()>> {
|
||||
self.worktree_store()
|
||||
.read(cx)
|
||||
.update_or_create_branch(repository, new_branch, cx)
|
||||
}
|
||||
|
||||
pub fn blame_buffer(
|
||||
&self,
|
||||
buffer: &Model<Buffer>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue