Register local worktrees after acquiring a project remote id
This commit is contained in:
parent
4053d683d9
commit
1e8ef8a4c1
2 changed files with 22 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -5652,6 +5652,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"client",
|
"client",
|
||||||
|
"clock",
|
||||||
"gpui",
|
"gpui",
|
||||||
"language",
|
"language",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
@ -130,6 +130,27 @@ impl Project {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(project_id) = remote_id {
|
||||||
|
let mut registrations = Vec::new();
|
||||||
|
this.read_with(&cx, |this, cx| {
|
||||||
|
for worktree in &this.worktrees {
|
||||||
|
let worktree_id = worktree.id() as u64;
|
||||||
|
let worktree = worktree.read(cx).as_local().unwrap();
|
||||||
|
registrations.push(rpc.request(
|
||||||
|
proto::RegisterWorktree {
|
||||||
|
project_id,
|
||||||
|
worktree_id,
|
||||||
|
root_name: worktree.root_name().to_string(),
|
||||||
|
authorized_logins: worktree.authorized_logins(),
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for registration in registrations {
|
||||||
|
registration.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.update(&mut cx, |this, cx| this.set_remote_id(remote_id, cx));
|
this.update(&mut cx, |this, cx| this.set_remote_id(remote_id, cx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue