Migrate most callers of git-related worktree APIs to use the GitStore (#27225)
This is a pure refactoring PR that goes through all the git-related APIs exposed by the worktree crate and minimizes their use outside that crate, migrating callers of those APIs to read from the GitStore instead. This is to prepare for evacuating git repository state from worktrees and making the GitStore the new source of truth. Other drive-by changes: - `project::git` is now `project::git_store`, for consistency with the other project stores - the project panel's test module has been split into its own file Release Notes: - N/A --------- Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
9134630841
commit
cf7d639fbc
26 changed files with 6480 additions and 6429 deletions
|
@ -513,21 +513,10 @@ impl TitleBar {
|
|||
}
|
||||
|
||||
pub fn render_project_branch(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
|
||||
let entry = {
|
||||
let mut names_and_branches =
|
||||
self.project.read(cx).visible_worktrees(cx).map(|worktree| {
|
||||
let worktree = worktree.read(cx);
|
||||
worktree.root_git_entry()
|
||||
});
|
||||
|
||||
names_and_branches.next().flatten()
|
||||
};
|
||||
let repository = self.project.read(cx).active_repository(cx)?;
|
||||
let workspace = self.workspace.upgrade()?;
|
||||
let branch_name = entry
|
||||
.as_ref()
|
||||
.and_then(|entry| entry.branch())
|
||||
.map(|branch| branch.name.clone())
|
||||
.map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH))?;
|
||||
let branch_name = repository.read(cx).current_branch()?.name.clone();
|
||||
let branch_name = util::truncate_and_trailoff(&branch_name, MAX_BRANCH_NAME_LENGTH);
|
||||
Some(
|
||||
Button::new("project_branch_trigger", branch_name)
|
||||
.color(Color::Muted)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue